How to web scrap data into the next empty row?

Hi , i am trying to create an automatic Uipath studiox process that is able to update an excel sheet daily with stock prices from the internet. I would want it to be able to find the next empty row in the excel table to update the columns " Date" , current price of stock A , current price of stock B , current price of stock C.

  1. I have managed to retrieve the 3 stock prices for yesterday 31/12/2020 from the website and wrote it into my excel sheet ( row 7).

  2. However , i do not know how to get UiPath to find the next empty row in the table which contains column " Date" , current price of stock A , current price of stock B , current price of stock C. i.e., i want to run an automatic process to update today’s 1/1/2021 stock prices and date in row 8 of excel sheet and tomorrow’s stock prices and date in row 9 and so on.

For all your advice please. Thank you.

@msgoh
can you share screenshot of the existing workflow

Hi Elina,

Above Write cell, i indicated Use Excel.


After Click , i wrote Get Text followed by Write Cell into B7.
Basically i repeated the process for the other two stocks. Not sure if this could be done in a better way that allow me to automate it into the next empty row . Many thanks.

@msgoh
1)Build Datatable and then add the values to the datatable using “Add row” activity from 3 website one after the other
2)then finally write it to the excel sheet
[OR]

  1. you can use read excel and assign it to the datatable(dt_sample) before “Write cell” Activity
  2. Then in “write cell” Activity ->where to write - modify the value to “[portfolio]Sheet1!A”+(dt_sample.rows.count+1).Tostring
    This will get the number of rows present in the excel and then write to the next row
    Note:check if Header is included/not in the excel using the read activity and change the incremental accordingly.

Let me know if you need any clarification

1 Like

HI Elina , i would like to utilise method 2 .
Could you help me to understand for point 1) , i will have to select “Read Cell Value” ? and place it above my “1.2 Write Cell” or to place it after i “Get Text” from the browser e.g., after 1.3.1.3 Get Text ?

@msgoh
Please try in the below order
1)“Get Text” Activity
2)“Excel Read range” Activity
3) “Write Cell” Activity