Writing datatable to excel

Is it possible to write a datatable which has 2 columns, to a excel sheet which has alot of columns? e.g. appending to excel column M and N with the data from the datatable.

i’ve tried this but it erases all the existing data in the other columns.

Hi @TyraS

If you are trying to append the Data to the existing Excel then use Append Range Activity

Mark as solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

1 Like

Oh i cant enter the column that i want to write into? Theres a field in write range that i could enter

Hi @TyraS

If you know the column for which you want to write into, you can specify the starting cell when you use the Write Range activity, for example entering “M1” into Starting Cell will write the datatable into columns M and N. Be careful with the “Add Headers” option as well.

Hi I did this way. But the values in the columns before M and N all disappeared and become blanks. I have no idea why

That is strange… As you are not touching these columns, this should not happen! Someone may be able to help resolve that.

Another method you could try would be to read the sheet as a datatable, then append the columns from your second datatable to create one datatable of all the data. You can then then overwrite all the content from the sheet. If you have a large amount of rows, sensitive data or data that cannot be stored accurately within a datatable, this may not be a practical solution so please consider this!

Yeahh i just tried the first way on a dummy file, if it put the datatable on column M, everything before the column will disappear…