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

Free Support Forum - aspose.com

Aspose Cells giving "file format is not supported or you don't specify a correct format"

Hi Aspose Team,

For one of the excel file we are getting fileFormatType as unknown.
These excels files we get from our clients through emails.
Able to open it without any issue, only when trying to read using aspose cells(21.4) we are getting the issue.
Any suggestions or work around to read the excel file

@hruser,

Please zip and attach the Excel file here, we will check it soon.

Hi @Amjad_Sahi
Please find the excel file that we are not able to read
ACH.zip (375 Bytes)

@hruser,
This file is not in XLS format but in CSV/TXT format. You may change its extension it to .txt and open it in Notepad. You will see that it is a text file. Hence you may try to load it as txt file to avoid this error. Please give a try to the following sample code and share the feedback.

String path = "ACH.XLS";
FileFormatType fileFormatType = FileFormatUtil.DetectFileFormat(path).FileFormatType;
if (fileFormatType == FileFormatType.Unknown || fileFormatType == FileFormatType.Csv)
{
    TxtLoadOptions txtLoadOptions = new TxtLoadOptions();
    Workbook workbook = new Workbook(path,txtLoadOptions);
}

Hi @ahsaniqbalsidiqui
Thank you for the solution, yeah we are able to get the data from the excel now using above method.

@hruser,

Good to know that the suggested code segment works for your needs. In the event of further queries or issue, feel free to write us back.

1 Like