Adding text next to existing data table rows

Hello guys. I have a question. I have a extract Table Data activity. It goes to google search and takes the first page’s results. How could I manipulate the data table, so that for each row that it takes, it would add a timestamp to every row and the keyword it searched for? For now I get this result.


But im aming for this:

Thanks in advance:)

P.S. In the A collum is the keyword that was inputed to google search

@Povilas_Jonikas

If value is same across the rows then we can use expressions to fill the data across rows

Read the data into datatable and then use the below in assign

Dt.Columns(0).Expression = "’keyword’"

Dt.Columns(2).Expression = "’" + Now.ToString("MM/dd/yyyy hh:mm:ss") + "’"

If data for each row is different then use for each row in datatable and then

Currentrow(0) = "value searched"

Currentrow(2) = Now.ToString("MM/dd/yyyy hh:mm:ss")

Hope this helps

Cheers

2 Likes

HI @Povilas_Jonikas

What you can do is as the process is in for each row in datatable
Use Add Datacolumn and name the new column as Date in the input dt
Inside the foreach Given an Assign
CurrentRow(2) = Now.ToString(“yyyy.MM.dd hh:mm:ss”)

Below the for each

Write the datatable and the datable will be updated in the excel

Regards
Sudharsan

1 Like

Thanks for the responses, but ill try out your steps first. Do you mean like this?

Because I now get an error
image

Yes Exactly the error is because you copy pasted the expression Now.ToStrng(“”)

Remove and retype the double quotes in that expression

Regards
Sudharsan

1 Like

You want to add the date in the existing (i.e the datatable you are using to loop) datatable right?

If yes you need to place the Add data column above the for each and give the datatable as dtTable

Regards
Sudharsan

1 Like

Im sorry for not making it easy to understand. I want to add the date and the keyword to the datatable that is being taken out of google (the data table that is generated after Extract Table Data Activity.), but not for the one is thats used for looping

I want to add date and keyword text to the data table rows that are extracted from google

Hi @Povilas_Jonikas
Give a try to this.
DT.Columns(0).Expression=“'”+Dt.Columns(0).ColumnName+“'”

DT.Columns(2).Expression=“'”+Dt.Columns(2).ColumnName+“'”

Sample Workflow
CopyData.xaml (7.5 KB)

Or

Use for each row activity and inside use assign activity
CurrentRow(0)=DT.Columns(0).ColumnName
CurrentRow(2)=DT.Columns(2).ColumnName

Hope this helps

2 Likes

Hi @Povilas_Jonikas

  1. Use the Extract Table Data activity to extract the table data from the Google search results page.
  2. Add a new column to the data table using the “Add Data Column” activity. Set the name of the new column to “Timestamp” and the data type to “DateTime”.
  3. Add another new column to the data table using the “Add Data Column” activity. Set the name of the new column to “Keyword” and the data type to “String”.
  4. Use a For Each Row activity to loop through each row of the data table.
  5. Inside the For Each Row activity, use the “Assign” activity to set the value of the “Timestamp” column to the current date and time using the “Now” function.
  6. Use another “Assign” activity to set the value of the “Keyword” column to the search keyword that was used to extract the data.
1 Like

Thanks guys, a lot of useful information!

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