For Each Row In Data Table not going thru all rows?

Hi there.

Wondering here why a datatable with 2 records(rows) only showing 1 row when the “For Each Row in Datatable” activity is used.

Hey! Welcome to community!

Could you please show us where you created the seq As a counter variable?

That should be initialize with 0 before for each row…

Pass the row like this

CurrentRow(0).ToString.Trim

Try this and let me know

Regards,
NaNi

Hi,

It seems your first row (IDX= 0) is read as header.
Can you check settings of ReadRange activity?

It should be

Range is “A4” and AddHeaders OFF

OR

Range is “A3” and AddHeaders ON

Regards,

Hello @im_sre-ps

after the output datatable you have given the writeline acitivty. can you check whether in the output it is printing all the rows as desired.

If it is there, it should work with the flow which you have created.

hi @THIRU_NANI. thanks for that.

The seq is just a counter indicator declared in the sequence to see who many loop the for each went thru.

hi @Yoichi

The IDX is ignored actually ignored because the name of the range in the excel file is declared.

Heyy @im_sre-ps ,

Initialize with 0

Regards,
NaNi

HI,

For now, can you try to turn off add headers option?

Or

set “B3” in Range property?

Regards,

Hi @Rahul_Unnikrishnan .

That is actually what Im trying to compare using the same datatable.

case 1: Green is the datatable with 2 records w/c is correct.

case 2: Red is the for each activity indicating per record but only showing 1 row.

Hi @Yoichi .

Your solution to remove the “Add Headers” Property solved the issue of the “For Each Row in Datatable” activity.

However does this mean that when counting the rows of the data table the header row is counted also?

Anyway thanks for the tip.

Hi,

No, if we set AddHeaders option Off, column name is automatically generated like Column1 Column2… and actual rows is as it is.

I think it’s matter of ReadRange activity to read from table name.

As workaround, can you try to use ReadRangeX with UseExcelFile as the following?
It will work well, even if add headers option is ON.

Regards,

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