You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When importing a CSV file that has empty columns, a "duplicate column names" error is thrown when calling getHeader(). According to the documentation, extra fields should be truncated. I've examined the raw text file and the extra columns are "clean" -- there are no characters between the commas delineating columns. I don't see anything in the documentation suggesting additional steps required to auto-truncate these fields. Ref: https://csv.thephpleague.com/9.0/reader/
Standalone code, or other way to reproduce the problem
@lcdservices thanks for using the package. I believe you misread the documentation or perhaps the documentation is not clear enough. When using the setHeaderOffset the package will use the selected record as header. Upon selection the package will examine the content of the selected record.
In you case you seem to have multiple empty columns which means that the record you selected contains multiple fields with empty value which result in the error you are seeing.
To avoid that error you can either stop using ay header at all OR when using a retrieving method like getRecords or getRecordsAsObject fill in the $heaader parameters which will super-seed the header record.
Bug Report
Summary
When importing a CSV file that has empty columns, a "duplicate column names" error is thrown when calling getHeader(). According to the documentation, extra fields should be truncated. I've examined the raw text file and the extra columns are "clean" -- there are no characters between the commas delineating columns. I don't see anything in the documentation suggesting additional steps required to auto-truncate these fields. Ref: https://csv.thephpleague.com/9.0/reader/
Standalone code, or other way to reproduce the problem
Expected result
Empty columns ignored/truncated and getHeader() returns column names without error.
Actual result
Error thrown.
Checks before submitting
The text was updated successfully, but these errors were encountered: