Can anyone help the overwriting issue in the for each loop when write range please?

Hi,

  1. I am getting data from several webpages.
  2. For each page, I am getting a list of data, say pdffile names
  3. I save the list into the datatable within each loop
  4. In the end I want to save all of them into a excel file
    Ideally I thought the 2nd loop would save from the row under the last row of the current sheet, but it overwrote from cell A2. If I use append… it went to hundreds of repeated records…

I attach my xaml here, can anyone help please? Thanks.
test.zip (49.7 KB)

I checked the solution in an old post, but it used counter =counter +1 , I don’t know how to modify into my for each activity …
Write range overrides and gives the latest file processed data. how to get rid of this overridden thing?

@MiaS - I guess, I have fixed it. Please take a look.

ForEach_Issue_Mia.zip (51.7 KB)

Thanks so much!
It works so well and I am still trying to figure out what you have changed… Is it possible you could briefly explain it if you have time? No worries if not, I will keep working on it.
BTW, the regex method you taught me in my first post helps a lot, and I always refer to it when trying to extract information. Thanks again.

1 Like

@MiaS - 1. I have moved the build data table out of the loop(ie, before the for each).

  1. Write Range - Moved the write range after the for each.

I guess , these are all the only changes I have made. Finally wrote the output to Sheet2.

1 Like

Thanks. It makes so much sense.
I need to put the build datatable activity outside of the loop so it could keeps saving data into the datatable after each loop. :grinning:

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