Saturday, March 24, 2012

Loop through excel sheet rows

Hi,
I have created an application where I can write to a particular cell in an excel spreadsheet.

How can I loop through each row of the excelsheet so that I can place the database row data into each row of the sheet?

something like:

foreach excelsheetRow (i)
//i represents the row number
cell(Ai).value = DataRow(i).column(i);
cell(Bi).value = DataRow(i).column(i+1);
cell(Ci).value = DataRow(i).column(i+2);
...

Thanks

HI

There are several ways to access excel (you could loop throught offset):How to: Refer to Worksheet Ranges in Code.

Hope it helps.

0 comments:

Post a Comment