Excel Header for Empty Data table

Hi,

I am not able to write Excel header when the data table is empty/No rows. I checked the Add headers options in write range inside Excel application scope.

I could write headers when there is a row in Data table. Can anyone please suggest to write Excel headers when data table is empty?

Thank you in Advance!

@SudhaRajesh

May I know why you want to write headers when you don’t have any rows in the Datatable?

Before writing into excel sheet use below expression to check whether Datatable contains any rows or not. If it is more than zero then write it else stop writing.

yourDT.Rows.Count

Thanks for your Response!

My requirement is always write excel headers irrespective of row count in the data table. I gave headers in First row of data table and unchecked Add headers in write excel activity. Is there any best way to approach this?

Thanks in advance.

@SudhaRajesh

I guess the one you followed is correct.

Thank you for your time and prompt response!

1 Like

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