XLSIO - cannot open CSV files above 15kb in size

Good day,
I am in need of opening csv files but have run into a snag. Every csv that I have tested that is under 15kb in size opens with no problem. But every doc that is larger than that does not work. I tried setting the excel version to 2013, 2016, & 2019, and have the same behavior with all of them. I simply get a generic error stating: "Cannot recognize file type" on the "application.Workbooks.Open" command.
I am using this sample code found on the forum. It came with a sample doc titled "CSVFile.csv", which works find but it is a very small doc.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Instantiate the application object
IApplication application = excelEngine.Excel;
//Set default application verion as Excel 2013
application.DefaultVersion = ExcelVersion.Excel2013;
//Open CSV file
IWorkbook workbook = application.Workbooks.Open("../../Data/CSVFile.csv");
//Save CSV file
workbook.SaveAs("Output.csv", ",");
}
Any help is appreciated.

3 Replies

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 20, 2021 12:13 PM UTC

Hi Travis, 

Greetings from Syncfusion. 

We are unable to reproduce the reported issue at our end. Also, we suspect that the issue might me file specific and not related to file size. We request you to share the input CSV file for which you are facing the exception, which will be helpful for us in investigating the query. 

Also, please confirm the Syncfusion XlsIO version you are using at your end. 

Regards, 
Keerthi. 



TC Travis Chambers April 2, 2021 03:34 AM UTC

Hi, I apologize for my delay in getting back to this. I had to step away from this for a while but I have had a chance to revisit this issue and I discovered the cause of the issue and wanted to share. I originally thought that file size for the CSV was the issue, but as it turns out it is a character in one of the column headers that is causing the "cannot recognize file type" error.

The column header in question looks like this: 

Owner ID

It is an odd column header, and unfortunately I cannot control the column headers in the document as it is an export document from a third party system. It is the upside down question mark (¿) character that is preventing the document from being read. Removing that character from the column header allows XLSIO to read it just fine.

Since I cannot control the formatting of the document I cannot think of any good work around. If you have any ideas, please share.

Thank you!


SK Shamini Kiruba Sobers Syncfusion Team April 2, 2021 10:01 AM UTC

Hi Travis, 

Thanks for the update. 

But we are still unable to reproduce the issue with the shared information. As mentioned earlier, we request you to share us the input CSV file used at your end to reproduce the issue, so that we can check at our end and provide prompt solution at the earliest. 

The sample we tried at our end can be downloaded from the following link. You can also modify the sample or the file used, to replicate the issue and send back to us for further analysis. 

Regards, 
Shamini 


Loader.
Up arrow icon