The current CSV parser has a number of issues including not being able to deal with long column names and multiple column names to name a few. There is also not good support for XLS and other file types.

This PHP library https://github.com/ddeboer/data-import would be a good candidate to handle file parsing for CSV, XLS and has an easy to use API for adding more.

It would be much easier to improve the parsing of CSV and other file types if it is extracted to a library that is maintained fully for that purpose and makes testing and enhancements easier.

Comments

acouch created an issue.

MegaChriz’s picture

Great suggestion. The library also hasn't much dependencies which is great also.

As about which library to choose, I'm not sure. There are tons of CSV libraries on packagist. See https://packagist.org/search/?q=csv. Perhaps we should just pick the one that you suggested. It looks like the library is quite popular (300 000+ installs) even though it hasn't a stable release yet.

acouch’s picture

We are experimenting with it http://github.com/nucivic/datastore as a way to parse different file types and store them in SQL then export them back. We'll let you know our experience but so far so good.

twistor’s picture

Personally, I don't want to add XLS support to Feeds core. That's just asking for trouble.

It would be trivial to create another module that uses this library.

The current CSV parser has a number of issues including not being able to deal with long column names and multiple column names to name a few.

Can you please elaborate on this?

Alex72RM’s picture

Why not invest in importing from xls / xlsx? With the csv I lose the formatting of the text (in the xls-> clsv conversion), while if I managed to import directly from the native format this would not happen.

MegaChriz’s picture

As seen on https://www.drupal.org/node/856644, three projects already exist for Feeds XLS import:
https://www.drupal.org/project/feeds_excel
https://www.drupal.org/project/feeds_xls
https://www.drupal.org/project/feeds_spreadsheet

None of them have D8/D9 support yet.

Importing from XLS would be nice, but I think it's better to handle that in a separate module. (Because then I don't have to deal with XLS specific issues in this issue queue ;)).