How to write One particular datatable column in an already opened excel file?


I have a datatable with about 50K rows and 30 columns. And, i need to write one particular column from that data table into an excel that is already opened.

Excel also contains 30+ columns. I would like to write the values in column number 5.

Any suggestions appreciated.

PS: The excel file that i use has predefined validation. Hence it is mandatory that i use that particular file rather than writing the entire datatable in a new excel.


Hi @SudhakarAs92

Use assign

Dt =dt.Select(“[column name]=‘value’”). Copytodatatable ()

To provide context to @AshwinS2’s answer, Dt should be a new datatable variable. The select statement can be anything - if you just want a single column, just provide dt.Select(“[column name]”).CopyToDataTable() instead. Finally, you should use the write range activity to paste the datatable you just created with the select statement. Be sure to specify the correct starting location (e.g. “E1”) and check the “AddHeaders” box if needed.

Thanks, let me try and get back !