first steps for specimen import (missing ExcelUtils update)
[cdmlib.git] / cdmlib-commons / src / main / java / eu / etaxonomy / cdm / common / ExcelUtils.java
index 3829777f95af5242bc41676664b5acf83230c0f4..c8ba014d138faf542cfd296b158b091440825970 100644 (file)
@@ -32,13 +32,24 @@ public class ExcelUtils {
        
     /** Reads all rows of an Excel worksheet */
     public static ArrayList<HashMap<String, String>> parseXLS(URI uri) throws FileNotFoundException {
+       return parseXLS(uri, null);
+    }
+
+    
+       /** Reads all rows of an Excel worksheet */
+    public static ArrayList<HashMap<String, String>> parseXLS(URI uri, String worksheetName) throws FileNotFoundException {
        
        ArrayList<HashMap<String, String>> recordList = new ArrayList<HashMap<String, String>>();
 
        try {
                POIFSFileSystem fs = new POIFSFileSystem(UriUtils.getInputStream(uri));
                HSSFWorkbook wb = new HSSFWorkbook(fs);
-               HSSFSheet sheet = wb.getSheetAt(0);
+               HSSFSheet sheet;
+               if (worksheetName == null){
+                       sheet = wb.getSheetAt(0);       
+               }else{
+                       sheet = wb.getSheet(worksheetName);
+               }
                HSSFRow row;
                HSSFCell cell;