ForEach Activity with Write Cell

Hi,

I have a sequence that uses a For Each Activity to do a screen scrape to obtain information from a specific url and then uses a Write Cell (workbook) in “F1”. Is there a way to use this method so that the next information that is scraped from a specific URL is written in “F2” the next time it runs through the For Each activity? Sequence below.

@ryanhudgin
The For Each Row activity has an Index parameter that gives you the zero-based index of the current row item in the table. Assign a variable here and then you can reference that in your Write Cell activity. It’s zero-based so you’ll need to add 1 to it since Excel is 1-based.

Then your cell looks like "F"+(index+1).ToString instead of "F1"

3 Likes

Hi! That solution worked! I am trying to expand this to include another for Each Activity but when I add another one to the sequence it gives me the error "Option Strict On disallows implicit conversation between System.Data.DataTable to System.Collections.IEnumerable.

Please advise :slight_smile:

What are you trying to iterate through with the second For Each?

I am going to use another screen scrape to obtain another piece of information from a specific URL. I want to put this information into G1, G2, etc but the For Each has the validation that reads “Option Strict On Disallows…”

Wow i had no idea this feature was in here, must be something new? No longer need to create and increment a separate counter!

2 Likes

MY MISTAKE. I was using For Each not For Each Row

2 Likes

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