Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #2
MegaChriz CreditAttribution: MegaChriz at WebCoo commentedGreat 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.
Comment #3
acouch CreditAttribution: acouch at NuCivic (formerly Nuams) commentedWe 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.
Comment #4
twistor CreditAttribution: twistor as a volunteer commentedPersonally, 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.
Can you please elaborate on this?
Comment #5
Alex72RM CreditAttribution: Alex72RM as a volunteer commentedWhy 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.
Comment #6
MegaChriz CreditAttribution: MegaChriz at WebCoo commentedAs 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 ;)).