Excel fill column help

Hello i’m downloading 5 reports daily (excel format), and merge them in 1 with append range, thats ok, the 5 reports have the same number of columns. But now, i want to add a column in the consolidate to identify to which report they belong. Like in the image example, the column D.
The problem is the row extension of each report, can be different everyday, so i can’t use a fix row number.
image
Anyone have a suggestion, how i can do this?

we can use merge datatable, for handling some structure differences
Or
we add on datatable level the ReportID column on first Position
But as we can access the datacolumn also with the colname on datatable level we are independed on its position.

A harmonization done with other options would be also possible as well.

Hey @Ismael !! Add this column before the Merge! Take a look!

Properties:

  • Column Name: The name of the column you are creating
  • DataTable: The datatable that will receive this new column.
  • Type Argument: The type of the variable that will be in this column.
  • Default Value: It will be your String “Report #” on # will assume a variable value for the report number, so your code will be dynamic.
    image

Now do the Merge.

Hope it helps!!

Test1.xlsx (8.7 KB)
Main.xaml (8.1 KB)
I try that way, but isnt adding the column, here is the report example i’m using and the bot. I don’t know what im missing
thx for your answer!

Main.xaml (9.2 KB)

The “Add Data Column” activity Adds a column to a DataTable, not to an Excel. There is the possibility of adding it to Excel through the “Insert Column” activity, but you would need your excel formatted as a table. I believe he doesn’t come like that. I then created a DT variable and read the data from the table, added the desired column and then I wrote. Let me know if you have any doubts!

1 Like

thank you

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