How to pass screenscraped data into excel cells

Im trying pass my screepscraped data into excel cells. I read the data from this same excel file, search it from google and screepscrape it. Now I’m trying paste it into same excel file via excel application scope->add data row->write range and using assign counter = counter + 1. I got to use write cell and loop it somehow? Or what’s best solution for this?

@Darba

1.after reading excel
2.use for each row and use the same procedure ,there is no need of using counter.

Regards,
A Manohar

Hey, I tried that but my excel kept saying its being used by another process.Mainproblem.xaml (20.2 KB)

I want to read the info from excel, google scrape it and paste those results into excel cells.

@Darba

Before starting of the Process, please close the Excel.

in RUN, taskkill /F /IM excel.exe execute this.

Regards,
A Manohar

Hey, I got it ran through when I closed it on start, but it still doesn’t write into cells anything.

@Darba

Are you writing into the same Excel which you are reading.

Regards,
A Manohar

Yes I am

@Darba

before writing into Excel use Close Workbook activity or use kill process activity and specify the process name as “EXCEL” to close the Excel sheet.

Regards,
A Manohar

Hey I tried that too and earlier I was able write on cells 1 time at once but I needed write multiple times. I think there’s something wrong with my workflow

@Darba

use add data row,and store the values in Data table in for each row
Then store it in Excel for better practices.

OR In For each row try to close the excel for each time and check the performance.

Regards,
A Manohar

@Darba

  1. read excel data using Excel application scope and read range activity => the output will be a data table.
  2. Use for each row activity
    a. Search for the item on google.
    b. update the datatable with the scrapped data.
  3. use write range activity and write the updated data into excel

or

  1. read excel data using Excel application scope and read range activity => the output will be a data table.
  2. Use for each row activity
    a. Get position of the row in excel as
    rowIndex + 1 (if there any header)
    ExcelRowIndex = Datatable.IndexOf(row) + 1
    b. Search for the item on google.
    c. update the excel with the scrapped data using writecell activity.
    Mention range as +ExcelRowIndex

Let me know if this doesn’t work for you.

I tried first method it ran thru well, but it didnt write anything in the cells. 2nd method I dont get to work.

Can you please share your workflow or screenshots.

main.zip.zip (9.6 KB)

I got it work with 1 entry and 1 result written into excel file, but what when I have multiple entries and multiple cells I want write to? @Madhavi

@Darba,

Hi Darba,

What you’re doing might work but you have many unnecessary steps. There’s no need to access the excel that many times. The ideal way is adding the info into the datatable using a for each and using add data row. There’s no need for an index.
image
Once you add all to the datatable use write write range or other method to access just once the excel. This will help your performance a lot.

image
image

1 Like

@Darba Can you please send the input file as well.
At this point, I see flow breaks at-

  1. You are reading data from excel file using read range activity but you haven’t specified output variable. Your process will fail here itself.
    Also you are using this data to search in the webpage. Instead, searching a hard coded value ‘Nokia’. As there is no looping specified, this will work only once. That too not for dynamic values from excel.
  2. The search on google page will happen only if the excel contains any data. But in your workflow, you have opened the application and within application scope, reading the excel data.
  3. You have used a open browser activity. within which you are again calling a attach browser activity. Does this mean you are opening one webpage and searching data in different webpage?

keeping some assumptions, I have updated your file get dynamic value from excel and loop the same.
ScreenScrappedDataToExcel.xaml (15.8 KB)
Please check and modify as required.

Hope this helps!

1 Like

It’s that excel file in the zip folder I posted.

@rmunro Should I have the for each row+data row combination at start of the workflow where I check the names from excel I wand to google and data scrape? I have to return to write those googled data scrape values into excel anyways.

@Madhavi it works nearly as I want to. It prints the name of finances also into excel file like this:
image

Even tho I have those names allready in there but they are part of the data table I guess

How the for each row works it basically does what’s inside of the for each the amount of rows you have. So it doesn’t matter how many you have, if you add more or delete. It will count the rows in your datatable automatically and perform the action within the body. Check this, is the for each activity it’s the same as the for each row but the for each row is design for datatables. As well it includes a sample.


but If it works, just leave it like that. You can change it in the future. There’s a programming phrase that says “If it works, don’t touch it”. Good job.

Thanks, I will check it out and try.

@Madhavi If I leave it empty I get random “column1” named B column in the excel
image