1
0 Comments

I have approximately 100 CSV files that I need to combine into a single Excel spreadsheet, with all the data in one tab rather than separate tabs. The CSV files are identical in structure, each having 4,000 rows and 2 columns with headers and being around 60 KB in size.

I have looked for solutions to this problem, but all the ones I have found so far append the next CSV file to the end of the last row in the active tab rather than adding it to the columns immediately to the right of the last column.

Some examples of solutions I have found include using DOS copy method, a VBA script, Excel’s Data>New Query>From File>From Folder feature (for Excel 2013), and Windows Powershell scripts. However, all of these methods create a single Excel spreadsheet with around 400,000 rows of data, which is not what I need.

I would appreciate any suggestions for solving this issue. Thanks!

Edit: I have found a straightforward solution, which involves using r’s cbind() function to combine the data into a data frame and then writing it to a CSV file. The entire process took around 3 seconds. It was the right tool for the job! Thanks to everyone who contributed. Cheers!

Askify Moderator Edited question May 1, 2023