| Type | Name and description |
|---|---|
static boolean |
compareTwoCells(org.apache.poi.ss.usermodel.Cell cell1, org.apache.poi.ss.usermodel.Cell cell2, boolean isValueOnly = true)Compare two excel cells |
static boolean |
compareTwoExcels(org.apache.poi.ss.usermodel.Workbook workbook1, org.apache.poi.ss.usermodel.Workbook workbook2, boolean isValueOnly = true)Compare value of two excel workbooks |
static boolean |
compareTwoRows(org.apache.poi.ss.usermodel.Row row1, org.apache.poi.ss.usermodel.Row row2, boolean isValueOnly = true)Compare two excel rows |
static boolean |
compareTwoSheets(org.apache.poi.ss.usermodel.Sheet sheet1, org.apache.poi.ss.usermodel.Sheet sheet2, boolean isValueOnly = true)Compare two excel sheets |
static void |
createExcelFile(java.lang.String filePath)Create a new excel file |
static void |
createExcelSheet(org.apache.poi.ss.usermodel.Workbook workbook)Add a default sheet to workbook |
static void |
createExcelSheet(org.apache.poi.ss.usermodel.Workbook workbook, java.lang.String sheetName)Add a new sheet to workbook |
static void |
createExcelSheets(org.apache.poi.ss.usermodel.Workbook workbook, java.util.List<java.lang.String> sheetNames)Add multiple sheets to workbook |
static org.apache.poi.ss.usermodel.Workbook |
createWorkbook(java.lang.String filePath)Create new workbook |
static org.apache.poi.ss.usermodel.Cell |
getCellByAddress(org.apache.poi.ss.usermodel.Sheet sheet, java.lang.String cellAddress)Get cell by address |
static org.apache.poi.ss.usermodel.Cell |
getCellByIndex(org.apache.poi.ss.usermodel.Sheet sheet, int rowIdx, int colIdx)Get cell by index |
static java.lang.Object |
getCellFormula(org.apache.poi.ss.usermodel.Cell cell)Get cell formula |
static java.util.Map |
getCellIndexByAddress(org.apache.poi.ss.usermodel.Sheet sheet, java.lang.String cellAddress)Get cell position by address |
static java.lang.Object |
getCellValue(org.apache.poi.ss.usermodel.Cell cell)Read data from a single cell |
static java.lang.Object |
getCellValueByAddress(org.apache.poi.ss.usermodel.Sheet sheet, java.lang.String cellAddress)Get cell value by address |
static java.lang.Object |
getCellValueByIndex(org.apache.poi.ss.usermodel.Sheet sheet, int rowIdx, int colIdx)Get cell value by index |
static java.util.List<java.lang.String> |
getCellValueByRangeAddress(org.apache.poi.ss.usermodel.Sheet sheet, java.lang.String topLeftAddress, java.lang.String rightBottomAddress)Get cell values by addresses |
static java.util.List<java.lang.String> |
getCellValuesByRangeIndexes(org.apache.poi.ss.usermodel.Sheet sheet, int rowInd1, int colInd1, int rowInd2, int colInd2)Get cell values by indexes |
static java.lang.Object |
getColumnsByIndex(org.apache.poi.ss.usermodel.Sheet sheet, java.util.List<java.lang.Integer> columnIndexes)Get map of columns data |
static java.util.List<org.apache.poi.ss.usermodel.Row> |
getDataRows(org.apache.poi.ss.usermodel.Sheet sheet, java.util.List<java.lang.Integer> rowIndexs)Get data rows from a list of row indexes |
static org.apache.poi.ss.usermodel.Sheet |
getExcelSheet(java.lang.String filePath, int sheetIndex = 0)Get an Excel sheet |
static org.apache.poi.ss.usermodel.Sheet |
getExcelSheet(org.apache.poi.ss.usermodel.Workbook wbs, java.lang.String sheetName = null)Get an Excel sheet from an opening workbook |
static org.apache.poi.ss.usermodel.Sheet |
getExcelSheetByName(java.lang.String filePath, java.lang.String sheetName)Get an Excel sheet by name |
static java.util.Map |
getMapOfKeyValueRows(org.apache.poi.ss.usermodel.Sheet sheet, int keyRowIdx, int valueRowIdx)Get a map of {{key1:value1},... |
static int |
getRowIndexByCellContent(org.apache.poi.ss.usermodel.Sheet sheet, java.lang.String cellContent, int columnIdxForCell)Get row index by cell content |
static java.util.List<java.lang.String> |
getSheetNames(org.apache.poi.ss.usermodel.Workbook workbook)Get name of sheets in workbook |
static java.util.List<org.apache.poi.ss.usermodel.Row> |
getTableContent(org.apache.poi.ss.usermodel.Sheet sheet, int startRow, int endRow)Get the excel data to a list of rows |
static org.apache.poi.ss.usermodel.Workbook |
getWorkbook(java.lang.String filePath)Get workbook from existing excel file |
static java.util.List<java.lang.Integer> |
locateCell(org.apache.poi.ss.usermodel.Sheet sheet, java.lang.Object cellContent)Locate the first position of the cell based on the cell content |
static void |
saveWorkbook(java.lang.String filePath, org.apache.poi.ss.usermodel.Workbook workbook)Save workbook into file |
static void |
setValueToCell(org.apache.poi.ss.usermodel.Cell cell, java.lang.Object value)Set value to cell |
static void |
setValueToCellByAddress(org.apache.poi.ss.usermodel.Sheet sheet, java.lang.String cellAddress, java.lang.Object value)Set value to cell by cell Address |
static void |
setValueToCellByAddresses(org.apache.poi.ss.usermodel.Sheet sheet, java.util.Map content)Set multiple values to multiple cells with cell addresses |
static void |
setValueToCellByIndex(org.apache.poi.ss.usermodel.Sheet sheet, int rowIndex, int colIndex, java.lang.Object value)Set value to cell by cell index |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Compare two excel cells
cell1 - the first cell need to comparecell2 - the second cell need to compareisValueOnly - true if check value and type only regardless of cell style, false if notCompare value of two excel workbooks
workbook1 - the first workbook need to compareworkbook2 - the second workbook need to compareisValueOnly - true if check value and type only regardless of cell style, false if notCompare two excel rows
row1 - the first row need to comparerow2 - the second row need to compareisValueOnly - true if check value and type only regardless of cell style, false if notCompare two excel sheets
sheet1 - the first sheet need to comparesheet2 - the second sheet need to compareisValueOnly - true if check value and type only regardless of cell style, false if notCreate a new excel file
filePath - path of excel fileAdd a default sheet to workbook
workbook - the workbook that needs to add new default sheetAdd a new sheet to workbook
workbook - the workbook that needs to add new sheetsheetName - the name of new sheetAdd multiple sheets to workbook
workbook - the workbook that needs to add new sheetssheetNames - the list of sheet namesCreate new workbook
filePath - location path of excel fileGet cell by address
sheet - the sheet object that contains cellcellAddress - the address of cellGet cell by index
sheet - the sheet object that contains cellrowIdx - row index of the cellcolIdx - column index of the cellGet cell formula
cell - the cell object that need to get formulaGet cell position by address
sheet - the sheet object that contains cellcellAddress - the address of cellRead data from a single cell
cell - the cell that needs to read dataGet cell value by address
sheet - the sheet object that contains cellcellAddress - the address of the cellGet cell value by index
sheet - the sheet object that contains cellrowIdx - row index of the cellcolIdx - column index of the cellGet cell values by addresses
sheet - the sheet object that contains cellstopLeftAddress - the address of the first cellrightBottomAddress - the address of the last cellGet cell values by indexes
sheet - the sheet object that contains cellsrowInd1 - the row index of the first cellcolInd1 - the column index of the first cellrowInd2 - the row index of the last cellcolInd2 - the column index of the last cellGet map of columns data
sheet - the sheet object that contains the rowcolumnIndexes - indexes of columnsGet data rows from a list of row indexes
sheet - the sheet object contains the rowsrowIndexes - the list of row indexesGet an Excel sheet
filePath - the location of excel filesheetIndex - the index of returned sheetGet an Excel sheet from an opening workbook
wbs - the opening workbooksheetName - the sheet name of the workbookGet an Excel sheet by name
filePath - the location of excel filesheetName - the name of returned sheetGet a map of {{key1:value1},...{keyn:valuen}} from a row of keys and a row of values of a sheet
sheet - the sheet object that contains the rowkeyRowIdx - the index of the header rowvalueRowIdx - the index of row needs to get the dataGet row index by cell content
sheet - the sheet object that contains the rowcellContent - the content of the cellcolumnIdxForCell - the column index of the cellGet name of sheets in workbook
Get the excel data to a list of rows
sheet - the sheet object to get the datastartRow - the start row to get the dataendRow - the end row to get the dataGet workbook from existing excel file
filePath - location path of excel fileLocate the first position of the cell based on the cell content
sheet - the sheet object contains the cellcellContent - the content to locate the cell. If the cell is in Date format, the cellContent should be in (MM/dd/yyyy), e.g ("10/01/2019")Save workbook into file
filePath - the location of excel file that will be writtenworkbook - the workbook contains dataSet value to cell
cell - target cell needs to be set valuevalue - value with any data type (String, Numeric, Boolean, Date with format MM/dd/yyyy,
formula with character "=" at the beginning of the stringSet value to cell by cell Address
sheet - sheet in workbookcellAddress - cell address in sheetvalue - value with any data type (String, Numeric, Boolean, Date with format MM/dd/yyyy,
formula with character "=" at the beginning of the stringSet multiple values to multiple cells with cell addresses
sheet - sheet in workbookcontent - map object with "key" = "cell address" and "value" = "value" with any data type
(String, Numeric, Boolean, Date with format MM/dd/yyyy,
formula with character "=" at the beginning of the stringSet value to cell by cell index
sheet - sheet in workbookcolIndex - column index starts by 0rowIndex - row index starts by 0value - value with any data type (String, Numeric, Boolean, Date with format MM/dd/yyyy,
formula with character "=" at the beginning of the string