Issues with merging two CSV files onto an xlsx

Hi there,

I am trying to build a process which downloads two different CSV files and then writes them onto an xlsx workbook on separate sheets. I seem to be having no luck with this as I keep running in to different errors. If I could name the sheets too, that would be excellent.

What would be the easiest way in which I can do this? CSV doesn’t work properly with the excel application scope and I also can’t seem to use ‘create file’ to create a .xlsx file. I’ve also tried to get the csv files output as a data table to write down, but this doesn’t seem to work either.

Thanks for your help.

Use Read CSV (twice) to read both files into separate datatables.

Use Merge Datatable to combine the two datatables into a final third datatable (this assumes the columns in both CSVs are the same)

Use Write Range to write the third datatable to Excel. This creates the file for you. You don’t need to explicitly create the file.

Hi @dr1992 ,
Please take a look at this .

They should use Read CSV not Read Text.

Hey,

When I try reading csv, I get the error that the data doesn’t correspond with the headers. I have unticked the box to say there are no headers, but it still gets this error (I intend on using a macro on the xlsx to tidy things up after).

Are you using Build Datatable before Read CSV? You don’t need to do that. What’s happening is the columns you defined in Build Datatable don’t match what’s in the CSV. Take out the Build Datatable. Let the Read CSV build it for you.

I didn’t, it was the read csv which dished out the error.

But are you using a Build Datatable activity to set up the datatable before Read CSV?

Is the CSV consistent - same number of columns in every row? Does it use “,” or just , as the delimiter? If it doesn’t use the double quotes, maybe there is a , in some of the values and it thinks it’s a column delimiter not part of the value.