I wanted to simply copy just headers from one excel to another - I tried it with:
Invoke method
copying the whole table and then deleting every single row except of the headers (with Remove Data Row Activity and it does not seem to work. - always getting the empty excel sheet
creating headers manually (with Build Datatable) and again when I want to put it inside the other excel sheet - I get the empty sheet (Just in A1 cell is written: “Column 1”)
Important: When I use Activity: Output datatable (just to print my datatable to see whether I have good values and whether my table is empty)-> I actually get the right values (my headers). But then again in excel - nothing…
I am desparate, does anyone have solution for this?
@Manjuts90, can you please explain me detailed?
You mean - I should have something like this:
To assign headers to a variable headers (type: Datatable) and then to write it into excel?
(to mention also this: my target excel is empty at the beginning)
I still don’t get it
How do you mean to add data to the datatable? I do not have any datatable created… My excel is empty.
I defined datatable headers and assigned the sourcedt.Clone() to it… afterwards I wrote it in excel…
do you mean there is another way to add data to datatable?
I feel like the other solutions, while valid, are overly complicated. Can you read range (“A1:Z2”) Z being the last column where there is a header) into a datatable, leave the add headers option checked, and write range into the new sheet in A1? Then write cell/value “” into cells (“A2:Z2”) to clear that second row of data, leaving only the headers. You might be able to just specify the row (“2:2”).
Maybe you can write the empty datatable(only with the column titles ) into a csv file.
And then use [copy file ] utility to copy the [.csv] to [.xls] file.
That’s will show the column titles when you open the [.xls] file.