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
     
  • Method Summary

    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 lowercasing
    static 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)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      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 header
      clean - 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 get
      header - if there is a header row to be skipped
      clean - lower case
      f -
      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 -