Free Support Forum -

Getting a NullPointer Exception while accessing at com.aspose.cells.Cell.getType(Unknown Source)

I am trying to access a column of a Aspose.Cell Row which is a type of DateTime … tried to differentiate with row.get(startIndex).getType() … even if this also giving the NP Exception.

Code Snippet:

if(row.get(startIndex) != null && row.get(startIndex).getType() != CellValueType.IS_UNKNOWN)
if(row.get(startIndex).getType() == CellValueType.IS_DATE_TIME)

								cells.get(copyPosition, startIndex+1).putValue(row.get(startIndex).getDateTimeValue());
								cells.get(copyPosition, startIndex+1).putValue(row.get(startIndex).getValue());

Below is the exception trace.
java.lang.NullPointerException: null
at com.aspose.cells.Cells.n(Unknown Source)
at com.aspose.cells.Cell.a(Unknown Source)
at com.aspose.cells.Cell.p(Unknown Source)
at com.aspose.cells.Cell.b(Unknown Source)
at com.aspose.cells.Cell.getType(Unknown Source)

Can anyone provide any solution of it.

You may share your complete runnable console application along with a sample template file which can be used to reproduce this issue here. We will reproduce this scenario here and share our feedback accordingly.

P.S. Compress your sample data while sharing here for our testing.


Thanks for replying.

Please find the attachment to run the console based program. The attached program need some input files to run which need to kept in a particular folder as mentioned in the java file as an input.

Also 2 output files also need included into zip folder. (506.1 KB)

Please let me know if you have any issues.


I have tried to compile your code but there are lot of missing references. Could you please share the jar files/classes to resolve the following as I could not find the exact jar files?

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;

Share the complete class or at least relevant functions which are used in this code:


If possible share the runnable complete project (simplified as much as possible) along with all the dependencies for our testing which can be used directly to reproduce this issue here.


You can remove the LogManager ,Logger replacing with SOP(System.out.print). Also you can remove InvalidFormatException.

The method i am using in PMOUtils are described below:

public static boolean byteToFileSave(byte[] fileByte, String file) {
try {
OutputStream os = new FileOutputStream(file);

		os.write(fileByte);"File write Successfully " + file);

		// Close the file
		return true;

	catch (Exception e) {
		return false;

Hope this will help to compile the code.


We have logged the issue as “CELLSJAVA-43345” in our database for investigations. Once we will have some news for you, we will update you in this topic.

Moreover, also share the code for PMOUtils.getMemoryUse method for our reference.


Can you please let me know the dates of probable solution of this issue… I need an urgent fix cause i am implementing it in a solution.

Please find the below method details:
public static void getMemoryUse( String methodname ){

    int mb = 1024 * 1024;

     // get Runtime instance
     Runtime instance = Runtime.getRuntime();
     System.out.println("Method name " + methodname);

     System.out.println("***** Heap utilization statistics [MB] *****\n");

     // available memory
     System.out.println("Total Memory: " + instance.totalMemory() / mb);

     // free memory
     System.out.println("Free Memory: " + instance.freeMemory() / mb);

     // used memory
     System.out.println("Used Memory: "
             + (instance.totalMemory() - instance.freeMemory()) / mb);

     // Maximum available memory
     System.out.println("Max Memory: " + instance.maxMemory() / mb);


This issue is logged too recently and not analyzed yet due to other tasks in queue. You may spare us little time to analyze this issue to share an appropriate ETA .


Please note, your issue is due to the fact that you disposed the Workbook object but kept other objects such as Row/Cell objects and referenced them later on. After one Workbook being disposed, many resources will become unavailable and may cause unexpected exceptions when using objects in the Workbook. So you should remove the invocation of Workbook.dispose() from the method getFilterConnectNowData(…) to make the program work correctly.