Adding a column to the Data Table after a data scrape

I have a For Each loop which takes a search term value such as “Ui Path Developer” (saved in a variable called ‘template’) and searches the LinkedIn job page. Then I scrape the results of matching jobs into a data table and export it out to an Excel.

I’d like to add a column so I can identify which search term corresponds to the result sets. Example below. I tried using Add column activity after the scrape but got errors. Any suggestions?

Current behavior:
Capture

Hi!

After extracting the data to the datatable, before doing the For Each, you could use Add Data Column activity to add the desired column to the data table.

Then inside the for each, to populate the new column you need an assign activity like this: row("NewColumnName") = [TheValueYouWant].
After that, when you write the data table to excel it should contain what you’re looking for.

@sofsheikh

1.Before For each ,create a Build Data table and add the columns you want and store it in a Data table Dt.
2.use for each row
3.use Add data row and assign the scarped data variables in list of array to the data table Dt.

Regards,
A Manohar

Thank you for the responses. I am not understanding the directions but it may be because this is my first time trying this topic. I tried following the steps you two provided but I’m doing something wrong. I’ve attached my workflow for your review. What am I doing wrong?

Main.xaml (53.0 KB)

You want to add your new column after you run Extract Structured Data, because that will overwrite your datatable…

Nope, it did not work adding the add column after the extractdatatable. Any other suggestions?

Hi,
Were you able to look at the sequence I shared to see what I might not be understanding?

Hi! Sorry for the delay.

As @bcorrea said, ExtractDataTable variable is overwritten every time Extract Structured Data is executed. You need to add the results of each Extract Structured Data in another table that isn’t overwritten.

You can achieve this by creating a new DataTable variable at a higher level, and after each Extract Structured Data use Merge Data Table activity to add the newly extracted table to that variable.