Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何读取选定的Excel列_Excel_Vb.net_Exceldatareader - Fatal编程技术网

如何读取选定的Excel列

如何读取选定的Excel列,excel,vb.net,exceldatareader,Excel,Vb.net,Exceldatareader,使用来自和以下代码的ExcelDataReader: Dim stream As FileStream = File.Open(filePath, FileMode.Open, FileAccess.Read) '1. Reading from a binary Excel file ('97-2003 format; *.xls) Dim excelReader As IExcelDataReader = ExcelReaderFactory.CreateBinaryReader(strea

使用来自和以下代码的ExcelDataReader:

Dim stream As FileStream = File.Open(filePath, FileMode.Open, FileAccess.Read)

'1. Reading from a binary Excel file ('97-2003 format; *.xls)
Dim excelReader As IExcelDataReader = ExcelReaderFactory.CreateBinaryReader(stream)
'...
'2. Reading from a OpenXml Excel file (2007 format; *.xlsx)
Dim excelReader As IExcelDataReader = ExcelReaderFactory.CreateOpenXmlReader(stream)
'...
'3. DataSet - The result of each spreadsheet will be created in the result.Tables
Dim result As DataSet = excelReader.AsDataSet()
'...
'4. DataSet - Create column names from first row
excelReader.IsFirstRowAsColumnNames = True
Dim result As DataSet = excelReader.AsDataSet()

'5. Data Reader methods
While excelReader.Read()
    'excelReader.GetInt32(0);
End While

'6. Free resources (IExcelDataReader is IDisposable)
excelReader.Close()

如何读取选定的excel列?谢谢

欢迎使用StackOverflow:如果您发布代码、XML或数据示例,请在文本编辑器中突出显示这些行,然后单击编辑器工具栏上的“代码示例”按钮{},以很好地格式化和语法突出显示它!嗨,marc_s,谢谢你的建议。你所选择的专栏是什么意思?