简体   繁体   中英

Iterating through rows and columns of an Excel worksheet and getting the values

Is it possible to retrieve the value of a cell from the row and column index of an Excel.Worksheet? I need to itearate through all the rows and columns and get the values...

For row As Integer = 1 To worksheet.UsedRange.Rows.Count
    For col As Integer = 1 To worksheet.UsedRange.Columns.Count
      list.Add(worksheet.Cells(row, col)) 'this doesn't return the value of the cell
    Next
Next
list.Add(worksheet.Cells(row, col).Value)

尝试:

list.Add(worksheet.Cells(row, col).Value2)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM