thephpleague / csv

CSV data manipulation made easy in PHP
https://csv.thephpleague.com
MIT License
3.33k stars 333 forks source link

Detect delimiter of file automatically #523

Closed javierfh03 closed 4 months ago

javierfh03 commented 4 months ago
Q A
New Feature yes
BC Break no

Proposal

¿Could you develop in the next feature that the reader detects the delimiter automatically? I think it's good idea because you can validate the format of the file.

nyamsprod commented 4 months ago

@javierfh03 thanks for using the library. You can already detect the delimiter as explain in the documentation please refer to https://csv.thephpleague.com/9.0/connections/controls/#detecting-the-delimiter-character

The feature is already present so there's nothing to add to the library. Last but not least you should not have in most case to detect the CSV document delimiter. This information should be given to you by the CSV document producer as any automatic detection may lead to false positive hence the reason why the feature is optin and not automatically used in the context of the library.