【发布时间】:2013-04-17 02:42:12
【问题描述】:
我有多个从数据库查询生成的 csv 文件
\n 用于下面文本中的换行符
接收格式-
Month1.csv
ID,User,Year,Month1, Month2,Month3,...,MonthN \n 2,用户2,2012,12 \n 1,用户1,2011,5 \n 4,用户5,2014,56 \n 3,User4,2013,34 \n
Month2.csv ID,User,Year,Month1, Month2,Month3,...,MonthN \n 1,用户 1,2011,10 \n 2,用户2,2012,66 \n 3,User4,2013,40 \n 4,User5,2014,26 \n
Month3.csv ID,User,Year,Month1, Month2,Month3,...,MonthN \n 4,用户5,2014,67 \n 1,用户 1,2011,12 \n 3,用户4,2013,23 \n 2,User2,2012,11 \n
这里 col1,Col2 和 Col3 在每个 CSV 中都是相同的,但行顺序不一样。
我将所有这些 CSV 文件放在一个文件夹中,并将所需格式的 csv 放在同一个文件夹中,名称不同,ID、用户、年份、月份 1、月份 2、月份 3、...、月份 N 中的数据可用 col1(ID)、Col2(用户)和 Col3(年)
我想创建特定格式的 CSV 文件,如下所示 -
所需格式- ID,User,Year,Month1, Month2,Month3,...,MonthN \n 1,User1,2011,5,10,12,...,50 \n 2,User2,2012,12,66,11,...,12 \n 3,User4,2013,34,40,23,...,13 \n 4,User5,2014,56,26,67,...,52 \n
我想要 VBS 中的解决方案,这样我们就可以在任何 Windows 机器上执行它,而无需任何额外的软件。谁能帮我解决这个问题
【问题讨论】: