Package anlavn.file
Class Excel
java.lang.Object
anlavn.file.Excel
The Excel class support to read/write data from/to excel file.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionUse this method to read data from Excel file at filePath location.static void
WriteExcel
(String filePath, String workSheet, Iterator<Object[]> data) Use this method to write data to Excel file at filePath location.static void
WriteExcel
(String filePath, String workSheet, Iterator<Object[]> data, int beginRow, int beginCol) Use this method to write data to Excel file at filePath location.
-
Constructor Details
-
Excel
public Excel()
-
-
Method Details
-
ReadExcel
public static Iterator<Object[]> ReadExcel(String filePath, String workSheet) throws FileNotFoundException, IOException Use this method to read data from Excel file at filePath location.- Parameters:
filePath
- is specific location of Excel file, file name extension must be ".xlsx".workSheet
- is the name of the worksheet you want to work with.- Returns:
- all data cell as Iterator from workSheet in Excel file.
- Throws:
FileNotFoundException
IOException
-
WriteExcel
public static void WriteExcel(String filePath, String workSheet, Iterator<Object[]> data) throws FileNotFoundException, IOException Use this method to write data to Excel file at filePath location.- Parameters:
filePath
- is specific location of Excel file, file name extension must be ".xlsx".workSheet
- is the name of the worksheet you want to work with.data
- all data as Iterator that you want to write to workSheet in Excel file.- Throws:
FileNotFoundException
IOException
-
WriteExcel
public static void WriteExcel(String filePath, String workSheet, Iterator<Object[]> data, int beginRow, int beginCol) throws FileNotFoundException, IOException Use this method to write data to Excel file at filePath location.- Parameters:
filePath
- is specific location of Excel file, file name extension must be ".xlsx".workSheet
- is the name of the worksheet you want to work with.data
- all data as Iterator that you want to write to workSheet in Excel file.beginRow
- is number of begin row, 0 is the starting value and is the minimum.beginCol
- is number of begin column, 0 is the starting value and is the minimum.- Throws:
FileNotFoundException
IOException
-