How to keep headers in Write Range activity if there is not any data in a sheet?

Hello everyone!
Could you help me?

I need to keep my headers in a sheet if my table is empty. I have two sheets, one has some data but another hasn’t. Where i have some data I can see headers. And how can I format the table and headers in excel using my sequence (f.e i need to good in size cell if there is a long phrase inside and bold header)?

Thanks!

Hi @Leny

Welcome to uipath community
enable the property Add headers in write range activity buddy
That would work for sure
but still i would like to suggest you few things
–here you have used two write range activity so once after the first write range writes the second one will overwrite on the second
–instead if you are trying to insert the second set of records with DT1 then we can use append range activity instead of that second write range activity with DT1 datatable, as that would append the range instead of overwriting
for more info on this

Cheers @Leny

1 Like

unfortunately no, Add headers doesn’t work if it would so i’ll be so happy

Well that would write the headers alone for sure even though the table is empty
Cheers @Leny

If you dont have data in your datatable, it will not write anything. If you want it to pass the column headers you’ll have to put in a data validation step.

  1. If activity: YourDataTable.Rows.Count = 0
    a. On the false side leave it blank
    b. On the true side put in: Add Data Row activity - in the ArrayRow property put {string.empty}
1 Like

Thank you so much!
It works!!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.