Write range excel activity doesn't add headers of a Blank Datatable

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

@Anil_choudhary In write range property check add headers

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

Cheers @Anil_choudhary

Well Thanks a lot for your replies.
I agree you all are Robot Masters and might have worked on the same and have better knowledge.

But where you had mentioned all the things are tried and tested and then only i raised a Bug or issue here.

Will test these details as an individual workflow and not a whole code and will update this bug again.

Thanks

1 Like

@Anil_choudhary, can you share your workflow Screenshot. It will will help us to find the bug if possible.

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.

Will post it soon.

Thanks

Hi,

Please find the workflow for the issue as mentioned earlier.

ThanksSampleTest.zip (11.1 KB)

SampleTest.zip (11.1 KB)

SampleTest.zip (11.1 KB)

Please find the sample workflow

I’m asked for screenshot dude! I’m not using system.

Hi,

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.

Thanks

Hello Anil,

were you able to solve this issues, if yes how did you do it ? am struggling with the same issue now … appreciate your support …

Thanks
Hara

Hi,

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

1 Like

@Anil_choudhary @Hara_Gopal, guys can you please update your excel package and then check if it works.

#HappyRobotics

yes, no use. i think this problem occurs when we write the data from a build DataTable activity into an excel in a REF setup

@Hara_Gopal, can you please check it out.

1 Like

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,

Thanks

@Anil_choudhary make sense but I got it know that it was happning because of the outdated package only.

#HappyRobotics

use add data row activity, and add an empty row. This way Headers will be intact on the spreadsheet

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