Excel Datatable Not Read as Expected in For Each

Hi,

The workflow below is supposed to run 7 times because…


The extracted datatable is like this.
image

But it runs only 6 times not 7, and I don’t know why.

Could you please explain why it runs only 6 times?
The way I found out it ran only 6 rounds was via “Write Line” and “Write Cell” activities.

I attached the workflow file also.

Thank you for your answer in advance.
Danieltry_catch_argument_passing.xaml (13.2 KB)

Uncheck the Add Headers property of the Read Range activity.

4 Likes

That is the problem. @Daun , your workflow has AddHeaders enabled, but this should be unchecked.

2 Likes

You are absolutely right!!!

But then my question would be… why does “Write Cell” start writing from the first row not second.
Column A and C are the ones that “Write Cell” activity writes.

image

Write Cell is agnostic of the Read Range activity. When you write to a cell, you can specify whichever cell you want to write to. Your workflow iterates over cells using an index, so your updates with Write Cell are unaffected by whether or not the data has headers.

2 Likes

There are 7 rows in excel . So only 6 loops will happen as 1st row might have been considered as Header .

Can you please check whether “Add Header” property is check in properties of Read Range Activity.

If so please uncheck and try.

Hope it helps you .

1 Like

You can pass the range where you need to write your data. If you wanted to write it row wise. Increment the row count as per the excel and write your required data in excel

1 Like

I see. I specified where to put the data into the Excel like this “C”+count.ToString. My mistake! Thank you!

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