Import without moving columns around
Aug 19, 2009
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

File TypeSizeFile NameCreated On
application/pdf 13 KB ImportbyFirstRow.pdf 6/3/15 12:15 PM
This is an archive of my previous blog attachments are in the download control