Tuesday 15 November 2022

Import Excel file to List in .NET, Java and other programming languages

EasyXLS™ library allows you to import Excel data to List. 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.

The list contains the Excel rows, each row being an EasyXLS.Util.List object containing the cell values. EasyXLS.Util.List extends System.Collections.ArrayList for .NET version and java.util.Vector for Java version.

EasyXLS can be successfully used to also import large Excel files having big volume of data with fast importing time.

EasyXLS permits you to import Excel files without Excel installed, without Interop, without OLEDB or any other additional software installed.

Source code sample

The below example shows how to import Excel to List in .NET, Java, PHP, ASP, C++, VB6, VBS and Coldfusion.

// Create an instance of the class that imports Excel files ExcelDocument workbook = new ExcelDocument(); // Import Excel file to List EasyXLS.Util.List rows = workbook.easy_ReadXLSXActiveSheet_AsList("C:\\Samples\\Tutorial09.xlsx"); // Confirm Excel file import if (workbook.easy_getError() == "") { // Display imported List values EasyXLS.Util.List row; for (int rowIndex=0; rowIndex < rows.size(); rowIndex++) { row = (EasyXLS.Util.List)rows.elementAt(rowIndex); for (int cellIndex=0; cellIndex < row.size(); cellIndex++) { Console.WriteLine("At row " + (rowIndex + 1) + ", column " + (cellIndex + 1) + " the value is '" + row.elementAt(cellIndex)); } } } else Console.Write("Error importing Excel file C:\\Samples\\Tutorial09.xlsx " + workbook.easy_getError());


No comments:

Post a Comment