|I have a project where data is downloaded from a database we don't control. We get a spreadsheet that may have columns in a different order, and the titles may change. The user isn't comfortable with moving columns around to import via a view, and I thought it would be a good bit of code to have, so I've been working on it. So, I have created an agent that first looks at a file where the the new titles are on the first row, and the Notes field names are on row 2. Once this is all put into an array (I'm doing a lot of arrays of late it seems), I then get the spreadsheet with data and import based on the column title.
Basically, the first part maps the Notes field to a title on the spreadsheet - the second part reads the first row of the data spreadsheet, determines what column each is in, and imports each row. Fewer lines than I thought, but it works rather well so far. And getting the code to a point is pretty useful.
Here is the code:
Import based on spreadsheet title