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): NA
Hi buddy @Anil_choudhary
That would work for sure…you were almost done
–Make sure that you get the output from the Build datatable Activity with a variable named outdt of type datatable
–Then pass that variable outdt as input to write range Activity where enable the property AddHeaders in the property panel of the activity and check
Let me prepare an independent workflow and test it before i put it here.
I m sure i was facing the issues, but as per the other Robot Masters it seems i might be doing something wrong.
No issues, whenever you are near system you can use the attached workflow.
I m not in hurry to get a solution as I got an alternative or workaround for this issue and its working fine for me.
I didn’t get any solution to the exact problem.
But there is a work around to that.
As in my case i was sure what will be the header names for each excel or each sheet in an excel.
So I created a DT, added one row as my headers and then appended that particular DT to the Excel.
So it will first Create or append a new header row into the excel and then it will write the data of actual DT (0 or more rows).
But with this work around I will always have a header data.
Thanks a lot for your suggestion.
But once you had written your code using the work around, its better to let the code run using the work around.
No point in updating the Excel package and change it everywhere in the existing code.
In future codes i will use the latest package and will test it again,
hi, I am facing the same issue.
I was unable to add Column Names (using Build Data Table) to empty excel.
So . I added a Test row to my Build Data Table columns.
It worked with write range.
Now i delete the Test row from my new excel.Hope it helps