I recently had to import an Excel based database into an SQL database.  To 
complicate the matters data was all over the place in each file (3 separate 
tables in a single CSV file), and some numbers had commas (e.g. 8,253.45).

I used the Perl CSV module to read in each file (1500+) line at a time, get rid 
of the commas, and account for empty records/columns, and build the SQL insert 
statement for each table's data, and write all out to a single file of SQL 
statements.  Afterward, just ran the SQL statements against the database.

Using the CSV module to handle the heavy lifting made it trivial.  The most 
challenging part of the whole thing was to figure out the line numbers, and 
column numbers of where the data was, used Vim for that :).


sqlite-users mailing list

Reply via email to