EasyXLS™ library allows you to import Excel data to DataSet. The data can be imported from an Excel sheet or from the active Excel sheet. The entire sheet data or only data from ranges of cells can be imported.
EasyXLS can be successfully used to also import large Excel files having big volume of data with fast importing time.
The source code samples can be integrated in:
- ASP.NET web pages - Windows applications - Windows Forms (WinForms) - Console applications - Windows service applications - ASP.NET MVC web applications
EasyXLS permits you to import Excel files without Excel installed, without Interop, without OLEDB or any other additional software installed.
' Create an instance of the class that imports Excel filesDim workbook As New ExcelDocument
' Import Excel file to DataSetDim dataSet As DataSet = _
workbook.easy_ReadXLSXActiveSheet_AsDataSet("C:\Samples\Tutorial09.xlsx")
' Display imported DataSet valuesDim dt As DataTable = dataSet.Tables(0)
For row As Integer = 0 To dt.Rows.Count - 1
For column As Integer = 0 To dt.Columns.Count - 1
Console.WriteLine("At row " & (row + 1) & ", column " & (column + 1) & _
" the value is '" & dt.Rows(row).ItemArray(column) & "'")
NextNext
# Create an instance of the class that imports Excel files
workbook = ExcelDocument()
# Import Excel file to DataSet
ds = workbook.easy_ReadXLSXActiveSheet_AsDataSet("C:\\Samples\\Tutorial09.xlsx")
# Display imported DataSet values
dt = ds.Tables[0]
for row in range(dt.Rows.Count):
for column in range(dt.Columns.Count):
print("At row " + str(row + 1) + ", column " + str(column + 1) +
" the value is '" + dt.Rows[row].ItemArray[column] + "'")
Click here to see Continuous Code Listing
This screen shot shows the imported data from Excel sheet into DataSet.
EasyXLS enables you to import Excel data to DataSet either from the entire sheet or from a range of cells. Importing only a range of cells is a very useful option especially for large Excel files because it reduces the speed of the import process.
In order to import multiple cell ranges at once from Excel sheet, the range parameter must be passed to the method as union of ranges (multiple ranges separated by comma).
All the methods that allow importing Excel to DataSet have parameters that permit importing only ranges of cells.