Cannot get a STRING value from a NUMERIC cell
jpsingarayar opened this issue · comments
There is no header in the excel and my first column is a column with numbers. I dont want to treat that as an integer though.
public static void main(String[] args) {
PoijiOptions options = PoijiOptions.PoijiOptionsBuilder.settings()
.addListDelimiter("\r")
.disableXLSXNumberCellFormat()
.build();
List<DataResponse> employees = Poiji.fromExcel(new File("/Users/xarmy/output.xls"), DataResponse.class, options);
The first column data looks like this
4295172261
4295172262
4295172263
and my pojo is like this
public class DataResponse {
@ExcelCell(0)
private String id;
@ExcelCell(1)
private String param;
@ExcelCell(2)
private String description;
}
Getting an exception
Exception in thread "main" java.lang.IllegalStateException: Cannot get a STRING value from a NUMERIC cell
at org.apache.poi.hssf.usermodel.HSSFCell.typeMismatch(HSSFCell.java:636)
at org.apache.poi.hssf.usermodel.HSSFCell.getRichStringCellValue(HSSFCell.java:738)
at org.apache.poi.hssf.usermodel.HSSFCell.getStringCellValue(HSSFCell.java:720)
at com.poiji.bind.mapping.HSSFUnmarshaller.loadColumnTitles(HSSFUnmarshaller.java:141)
at com.poiji.bind.mapping.HSSFUnmarshaller.processRowsToObjects(HSSFUnmarshaller.java:83)
at com.poiji.bind.mapping.HSSFUnmarshaller.unmarshal(HSSFUnmarshaller.java:76)
at com.poiji.bind.Poiji.fromExcel(Poiji.java:257)
at com.poiji.bind.Poiji.fromExcel(Poiji.java:238)
at com.sct.Analyzer.main(Analyzer.java:22)
Disconnected from the target VM, address: '127.0.0.1:64743', transport: 'socket'
Thank you for contributing to Poiji! Feel free to create a PR If you want to contribute directly :)
Hi @jpsingarayar ,
Could you please share with my the excel file and its relevant model?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.