How to write the headers from a DataTable just once into an Excel log file?

Hi,

I need to save an Excel file with fixed headers on the first line of an Excel sheet and for each time the robot runs, the headers are not written a second time and only below data rows are written. This is my datatable:

datatable

So, somewhere in my workflow I have a BuildDataTable activity that will be then populated by add rows once information is written to it. Somewhere in the end of my workflow I have a sequence with an AddDataRow activity that will fill the data table recently created. For each row, there’s 5 columns and that means 5 variables with saved data ready to be written to a row.

In the very end of the workflow, I have an ExcelApplicationScope activity:

ExcelApplicationScope

The problem with the AppendRange activity is that I of course don’t have an AddHeaders option similar to the following example: https://www.uipath.com/kb-articles/how-to-write-data-to-a-csv-file

Basically, I think that what I need to know is where and how to write the headers in the workflow?

1 Like

Solved by adding an ExcelWriteRange activity inside the ExcelApplicationScope with the AddHeaders option checked!