Package ubic.basecode.io.excel
Class ExcelUtil
- java.lang.Object
-
- ubic.basecode.io.excel.ExcelUtil
-
public class ExcelUtil extends Object
Utilities for dealign with Microsoft Excel spreadsheets as implemented in commons-poi.- Author:
- lfrench
-
-
Constructor Summary
Constructors Constructor Description ExcelUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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)
static Set<String>
grabColumnValues(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int column, boolean header, boolean clean)
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 lowercasingstatic List<String>
grabColumnValuesList(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int column, boolean header, boolean clean)
static List<String>
grabColumnValuesList(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int column, boolean header, boolean clean, SpreadSheetFilter f)
static void
main(String[] args)
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
setValue(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int row, int col, String value)
-
-
-
Method Detail
-
getSheetFromFile
public static org.apache.poi.hssf.usermodel.HSSFSheet getSheetFromFile(String filename, String sheetName) throws IOException
- Parameters:
filename
-sheetName
-- Returns:
- Throws:
IOException
-
getValue
public static String getValue(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int row, int col)
- 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
public static void main(String[] args)
-
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
-
-
-