I'm getting the following error:
Exception in thread "main" java.lang.IllegalArgumentException: Invalid
char (/) found at index (0) in sheet name '/tmp/myexcel.xls'
at
org.apache.poi.hssf.record.BoundSheetRecord.validateSheetName(BoundSheetRecord.java:118)
at
org.apache.poi.hssf.record.BoundSheetRecord.setSheetname(BoundSheetRecord.java:91)
at org.apache.poi.hssf.model.Workbook.setSheetName(Workbook.java:551)
at
org.apache.poi.hssf.usermodel.HSSFWorkbook.createSheet(HSSFWorkbook.java:754)
at emp.Main.main(Main.java:198)
The code is as follows:
wb=new HSSFWorkbook(FileInputStream(args[0]));
sheet = wb.getSheet("ERP");
for(Row row : sheet){
rowindex=row.getRowNum();
for(Cell cell : row){
cellindex=cell.getColumnIndex();
String cellStringValue="";
double cellNumericValue=0;
if(cell.getCellType()==Cell.CELL_TYPE_STRING){
cellStringValue=cell.getStringCellValue();
}
else if (cell.getCellType()==Cell.CELL_TYPE_NUMERIC){
cellNumericValue=cell.getNumericCellValue();
}
if((headerRow==0) || (headerRow==rowindex)){
if(cell.getCellType()==Cell.CELL_TYPE_STRING){
if(checkCellforValue(cellStringValue,"Initiatives")){
description=cell.getColumnIndex();
headerRow=rowindex;
}
}
}
else{
if (cellindex==description){
descriptionValue=cellStringValue;
}
}
}
}
} catch (Exception e) {
System.out.println("Workbook initialisation Failed!");
e.printStackTrace();
return;
}
I'm using 3.6.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]