Can we insert header in excel using build data table without inserting data

can we insert header in excel using build data table without inserting data

You can. Just write the empty datatable to a worksheet using a Write Range activity and ensure that the Add Headers option is checked.

As mention in attachment where I need to put empty data table

It seems as though you have this written correctly, as long as DtProcessReport is the same datatable shown in the screenshot.

but I am getting object reference null error.Because data table not contain any value.if I pass static value like 1 then it work fine.But I want without data

Ah, in that case, what if you make the column header names the first row of the datatable and uncheck Add Headers?

but the think is I am executing same file multiple time then it create multiple rows.
because I am processing huge data almost 20 k records.So I run this for 2 hour then stop so on.it create multiple header in between records.if you did not understand let me know.I will again explain you

Do you mean that later in the code you populate the table and use it to insert more data into the spreadsheet? If so, and you no longer need the headers, you can remove the row you inserted with the headers immediately after you’ve put it into the workbook.

yes I done this this not working for me just give me 30 mint I will try again and update you

yes after remove row it remove excel but in data table record exist

Use the Clear Datatable activity, not the Excel remove row.

this will delete all data

Your datatable was empty at first. If you clear the data after you’ve inserted this one row and then remove it, that’s all it should remove. You should not remove anything else. If need be, you can use a Filter Datatable activity to remove anything where the first column element equals “Source”.