繁体   English   中英

遍历Excel工作表的行和列并获取值

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

是否可以从Excel.Worksheet的行和列索引中检索单元格的值? 我需要遍历所有行和列并获取值...

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)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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