I’ve seen quite some examples on how to import CSV using FasterCSV, SmarterCSV or the default CSV library. All those examples assume that the csv is in a certain format though.
I would have a fixed model containing address fields (street, hsno, city, etc) but I have no control over the data that is being uploaded.
I’m looking for a way to map the CSV data (by header names) to my model before the data is loaded in the model.
Any ideas would be greatly appreciated.
Maybe you can create a combo box with the model attributes and let the user choose which attributes a column should match.
Take a look at MailChimp import at the section “Mapping Fields” for an visual example.
(Sorry for the advertising, but this is the one example i can remember)