We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Getting Null Pointer Exception while reading Excel file data

Getting Null Pointer Exception if we read cell A1 from attached file.
We have used following code to read data.

Our use case specifically requires getDisplayStringValue() functionality.

Cell cell = cells.get(“A1”);
String displayStringValue = cell.getDisplayStringValue();

The code is working for other excels but attached excel’s A1 cell.getDisplayStringValue() throws null pointer exception. CopiedContent.zip (8.0 KB)

@kapil.jaiswal.1eq,

Thanks for your query.

We have tried following sample code using latest version Aspose.Cells for Java 18.12.0 but could not observe any issue. You may please try latest version and provide your feedback.

Workbook wb = new Workbook("CopiedContent.xlsx");
Cell cell = wb.getWorksheets().get(0).getCells().get("A1");
String displayStringValue = cell.getDisplayStringValue();
System.out.println(displayStringValue);

We have following aspose jar :
aspose-cells-8.4.0.jar

Can you please verify on this version and let us know what problem is and if there is any workaround for the issue.

Thanks for your support.

@kapil.jaiswal.1eq,

Well, since you are using some older version of the product, so we are not sure if there was some issue in your version of not. Neither we can evaluate your issue in older version or fix issues (if any) in older API. The fixes are based on latest APIs set only. As Ahsan Iqbal suggested, we recommend you to kindly upgrade to latest version/fix: e.g Aspose.Cells v18.12.x. If you find any issue using v18.12, we will analyze the issue and figure it out soon.