Package ubic.basecode.io.excel
Class ExcelUtil
java.lang.Object
ubic.basecode.io.excel.ExcelUtil
Utilities for dealign with Microsoft Excel spreadsheets as implemented in commons-poi.
- Author:
- lfrench
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.poi.hssf.usermodel.HSSFSheet
getSheetFromFile
(String filename, String sheetName) static String
getValue
(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int row, int col) grabColumnValues
(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int column, boolean header, boolean clean) grabColumnValues
(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int column, boolean header, boolean clean, SpreadSheetFilter f) Gets all the strings from a column, possibly excluding header and possibly trimming and lowercasinggrabColumnValuesList
(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int column, boolean header, boolean clean) grabColumnValuesList
(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int column, boolean header, boolean clean, SpreadSheetFilter f) static void
static void
setFormula
(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int row, int col, String value) static void
setValue
(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int row, int col, double value) static void
setValue
(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int row, int col, int value) static void
-
Constructor Details
-
ExcelUtil
public ExcelUtil()
-
-
Method Details
-
getSheetFromFile
public static org.apache.poi.hssf.usermodel.HSSFSheet getSheetFromFile(String filename, String sheetName) throws IOException - Parameters:
filename
-sheetName
-- Returns:
- Throws:
IOException
-
getValue
- Parameters:
sheet
-row
-col
-- Returns:
-
grabColumnValues
public static Set<String> grabColumnValues(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int column, boolean header, boolean clean) - Parameters:
sheet
-column
-header
-clean
-- Returns:
-
grabColumnValues
public static Set<String> grabColumnValues(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int column, boolean header, boolean clean, SpreadSheetFilter f) Gets all the strings from a column, possibly excluding header and possibly trimming and lowercasing- Parameters:
sheet
-column
-header
- true if it has a headerclean
- if true it will trim and lowercase the strings- Returns:
-
grabColumnValuesList
public static List<String> grabColumnValuesList(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int column, boolean header, boolean clean) - Parameters:
sheet
-column
-header
-clean
-- Returns:
-
grabColumnValuesList
public static List<String> grabColumnValuesList(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int column, boolean header, boolean clean, SpreadSheetFilter f) - Parameters:
sheet
-column
- the index of the column to getheader
- if there is a header row to be skippedclean
- lower casef
-- Returns:
-
main
-
setFormula
public static void setFormula(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int row, int col, String value) - Parameters:
sheet
-row
-col
-value
-
-
setValue
public static void setValue(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int row, int col, double value) - Parameters:
sheet
-row
-col
-value
-
-
setValue
public static void setValue(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int row, int col, int value) - Parameters:
sheet
-row
-col
-value
-
-
setValue
public static void setValue(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int row, int col, String value) - Parameters:
sheet
-row
-col
-value
-
-