Column restriction in CSV using Microsoft Jet OLEDB

I am importing data from a CSV that contains about 350 columns. This CSV import is fixed and I have absolutely no control over it.

If I try to open CSV in Excel 2003, it will only partially load due to column 255 (IV).

When I load CSV into a DataSet using OleDb and Microsoft.Jet.OLEDB.4.0, it also only shows 255 columns. However, however, when trying to access data for some of these 255 columns, they display invalid data and unevenly split the values.

If I open CSV in Excel, let it truncate the data and save it again, my import works fine.

My question is: has anyone else encountered this limitation with the Jet.OLEDB provider. If so, is there a workaround? If not, is there an alternative solution that can load such a large CSV?

Note. This is not one task; I need to provide the end user with a view / upload button that performs this import as needed.

+3
source share
4 answers
+3
source

You can go through this code. Use ExcelDataReader and add the link to your project. and use below code ...

FileStream stream = File.Open(strFileName, FileMode.Open, FileAccess.Read);
IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
DataSet result = excelReader.AsDataSet();
excelReader.Close();
return result.Tables[0];
+1

- . File Helpers. http://www.filehelpers.com/. . .

0

schema.ini , CSV. . .

0

Source: https://habr.com/ru/post/1705282/


All Articles