Add looped into datatable, find lastrow, clear content

excel
loop
activities
studio
datascraping

#1

This is my current project:
I’ve a list of invoice number in a sheet call “input”. Had build the robot to pick invoice number and search in a web and then scrape some data there. After that the scraped data should paste in “output” sheet in column B. In column A - should specify the respective invoice number (which was looped).

Issue that I’m facing:

  1. How to specify the respective invoice number (which was looped) in column A as shown in below screenshot. (blue highlight - looped invoice number, red highlight - scrapped data)
  2. What should I do to paste the scraped data into the last row (in this case, next scrapped data for next invoice number should paste at row 18)
  3. How do I compeletly clear content of old data in “output” sheet

Hope you guys could help me out.


#2

Hi, is there anyone to share ideas for point #1??


#3

Hi @Serran_Neru,

  1. Read this Excel using Read Range activity and store it in a datatable variable.And loop it using for each row activity then access invoice number as follow row(“Invoice Number”) this returns current row’s invoice number
  2. Start your operation of scraping data here and save it in another sheet (Output) as you said. My suggestion would be add it in a datatable using Add Data Row activity with pre-build datatable with headers such as Piece ID, Pickup Date…,etc
  3. Process Continues until you have invoice number
  4. Finally write it in the same sheet using Write Range Activity by specifying the range

Hope it helps you ! Sorry If I have confused you. Let me know if you have any concerns.

Thanks and Regards,
Dominic :slight_smile:


How to save the Output data in the same excel file
#4

Hello, any idea?


#5

Hi Dominic,
I couldn’t really get what you’re trying to say.