Aspose cells throwing IllegalStateException: toArray is not supported

Hi Aspose Team,

we are seeing below exception when reading excel files
IllegalStateException: toArray is not supported
at com.aspose.cells.b.a.d.zm.b()
at com.aspose.cells.a.a.zab.a(zm, boolean)
at com.aspose.cells.a.a.zz.d(String)
at com.aspose.cells.a.a.zz.c()
at com.aspose.cells.ztp.f()
at com.aspose.cells.ztp.(boolean)
at com.aspose.cells.zka.a(int, boolean)
at com.aspose.cells.zka.a(zm)
at com.aspose.cells.zka.a(String, zm, LoadOptions)
at com.aspose.cells.Workbook.a(String, LoadOptions)
at com.aspose.cells.Workbook.(String)

Can someone explain when and why we get this
Any solution to avoid the above exception
Thank you in advance.

@hruser,

Please zip and attach the template Excel file which we can use (for reading via Aspose.Cells APIs) to reproduce the issue. We will check your issue soon.

HI @Amjad_Sahi
Please find the attached sample
ACH.zip (375 Bytes)

@hruser,
As explained earlier here this file is not an XLS file but a CSV file. You may please use following sample code to read this file.

 String path = "ACH.XLS";
 int fileFormatType = FileFormatUtil.detectFileFormat(path).getFileFormatType();
 if (fileFormatType == FileFormatType.UNKNOWN || fileFormatType == FileFormatType.CSV)
 {
     TxtLoadOptions txtLoadOptions = new TxtLoadOptions();
     Workbook workbook = new Workbook(path,txtLoadOptions);
     for(Object obj : workbook.getWorksheets().get(0).getCells())
     {
    	 Cell cell = (Cell)obj;
    	 System.out.println(cell.getValue());
     }
 }

Hi @ahsaniqbalsidiqui

yeah we are using the above code as suggested and its working.
The problem not with reading the excel but about the above exception
That we are getting, it is not only happening with this sample
also happening with couple of other samples, I had the attached sample handy so kept it here.

Wanted to know the reason for that exception and any workaround to avoid that ?

@hruser,
Could you please share your sample file as it is not possible to reproduce this issue here with our sample files? It is not possible to exactly define the cases when this exception may raise however if you can share some sample file, we will look into it and share our feedback accordingly.