using IronXL;
using System;
using System.Data;
// Supported for XLSX, XLS, XLSM, XLTX, CSV and TSV
WorkBook workBook = WorkBook.Load("sample.xlsx");
// Convert the whole Excel WorkBook to a DataSet
DataSet dataSet = workBook.ToDataSet();
foreach (DataTable table in dataSet.Tables)
{
Console.WriteLine(table.TableName);
// Enumerate by rows or columns first at your preference
foreach (DataRow row in table.Rows)
{
for (int i = 0 ; i < table.Columns.Count ; i++)
{
Console.Write(row[i]);
}
}
}
Imports IronXL
Imports System
Imports System.Data
' Supported for XLSX, XLS, XLSM, XLTX, CSV and TSV
Private workBook As WorkBook = WorkBook.Load("sample.xlsx")
' Convert the whole Excel WorkBook to a DataSet
Private dataSet As DataSet = workBook.ToDataSet()
For Each table As DataTable In dataSet.Tables
Console.WriteLine(table.TableName)
' Enumerate by rows or columns first at your preference
For Each row As DataRow In table.Rows
For i As Integer = 0 To table.Columns.Count - 1
Console.Write(row(i))
Next i
Next row
Next table
Install-Package IronXL.Excel
Excel zu SQL über System.Data.DataSet
Konvertieren Sie jede XLSX, XLS, XLSM, XLTX, CSV und TSV Datei in eine System.Data.DataTable für vollständige Interoperabilität mit System.Data.SQL oder um eine DataGrid zu befüllen. Dieses DataTable Objekt kann eine Sammlung von Tabellen, Beziehungen und Einschränkungen enthalten.
Sie brauchen schnell einen Beweis? PM > Install-Package IronXL.Excel Führen Sie ein Beispiel aus und sehen Sie zu, wie Ihre Daten zu einer Tabellenkalkulation werden.