Read cell inside for each row loop

Continuing the discussion from How to get value using read cell:
Hi Palaniyappan,

This will return 0 and hence cell address as A0. A0 doesn’t exist in the excel. I have been wondering, how this expression worked for @claudiojody

out_dt.Rows.IndexOf(row).ToString returns 0, right!

your observation looks right on the first look. So we could correct with out_dt.Rows.IndexOf(row) + 1
As it is used within a for each row we also could use the index output from the for each row

but coming back to the main task - reading in the excel Column A values and use it for other actions.

Here following can be done as well:

  • readin excel with a read range into a datatable
  • iterate over the rows with a for each
  • use the current value with row(0).toString
1 Like

Following worked for me.
read cell

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