Bug in Write Range Activity: Empty DT is not writing Headers in the Excel


Scenario: Write Range either workbook or Excel application scope doesn’t add headers of an empty datatable

Steps to reproduce:

Build an empty datatable with few columns headers. say Empid, empname, empcity
Not just write range this DT to an excel with AddHeaders activity selected.
It will generate a new blank Excel with excel name and sheet names whatever passed in the activity, but no headers.

Current Behavior: No headers are added to excel sheet if DT is blank or with 0 rows

Expected Behavior: it should atleast add the DT column names as headers to the write range activity of excel.

Studio/Robot/Orchestrator Version: 2019.5

Last stable behavior:NA
Last stable version:NA
OS Version: windows 7 64 bit professional
Others if Relevant: (workflow, logs, .net version, service pack, etc): NASampleTest.zip (11.1 KB)


1 Like

Hey @Anil_choudhary,

Please make sure add headers property is selected in write range property pane.

Create New File is unchecked in excel application scope.

Hi Thanks a lot for prompt response.

Did you executed the attached workflow?
If not please execute it once.
Please find it below


SampleTest.zip (11.1 KB)

If you really need the headers you can put them as first row and write the table without the checked box for headers.
But i don’t think you need an excel if you don’t have at least one value to work on, so maybe it is not a “bug”.

1 Like


But this workaround is implemented.
Not sure we should call it bug or not, but if the DT is there and the add headers is checked it should write the DT column names as headers in excel even if it doesn’t contains any data.


I encountered this issue as well. Add header is selected in write range, still execl file is blank incase of datatable with no rows in it.


I think this is an architecture without data what we will do in excel file. But If we go for logic and header is checked then it should write the header on excel file even there is no data on data table.

#loginerror (Please clear this confusion)


I encountered this issue as well. Strangely enough the robot ran in production for over 1 year and after making changed I stumbled upon it by accident. I haven’t seen this error before.