EasyXLS™ library allows you to import Excel data to ResultSet. 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.
# Create an instance of the class that imports Excel files
workbook = gateway.jvm.ExcelDocument()
# Import Excel file to ResultSet
file = gateway.jvm.FileInputStream("C:\\Samples\\Tutorial09.xlsx")
rs = workbook.easy_ReadXLSXActiveSheet_AsResultSet(file)
# Display imported ResultSet values
columnCount = rs.getMetaData().getColumnCount()
row = 0
while rs.next():
for column in range(columnCount):
print("At row " + str(row + 1) + ", column " + str(column+1) +
" the value is '" + rs.getString(column+1) + "'")
row=row+1
Click here to see Continuous Code Listing
This screen shot shows the imported data from Excel sheet into ResultSet.
EasyXLS enables you to import Excel data to ResultSet 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 ResultSet have parameters that permit importing only ranges of cells.
Import XLSX, XLSB, XLSM and XLS files to ResultSet