Merge CSV files using macro

前端 未结 2 749
时光取名叫无心
时光取名叫无心 2021-01-26 11:50

Any idea how to merge *.csv files from one folder?

I have many *.csv files with same structure (count & heading of columns) and I need to merge their content into on

2条回答
  •  鱼传尺愫
    2021-01-26 12:30

    There are a few ways to approach it (ex: SO 39045638)

    I personally use a .bat file similar to the below, where loc is the directory for the csv files. This doesn't handle deleting the Aggregate file, though. Nor does it handle repeated headers, so you would need to edit the final csv to remove them.

    @ECHO OFF  
    Set loc=C:\Test\
    Copy %loc%*.csv %loc%\Aggregate.csv
    

提交回复
热议问题