Importing CSV
Dec 11, 2009 18:37:23 GMT -5
Post by votan on Dec 11, 2009 18:37:23 GMT -5
I need to import data from a CSV file into a SQLite DB. I know there is an importer function in SQLite that allows me to specify a seperator like ",",but this would enter all data with the quotes.
But I want to import the following text (example below) without removing all the quotes first, as I need the data without the quotes. And using "","" as the sepretaor would also not help because of the leading and traling quotes.
Additionally I would also like to prevent the "somestuff" entries from being added to the DB.
Oh.. and another question.... will the importer ignore comment lines automatically (like #this is a comment, etc)? If not, I'll have to preparse the whole file before importing anyway...
But I want to import the following text (example below) without removing all the quotes first, as I need the data without the quotes. And using "","" as the sepretaor would also not help because of the leading and traling quotes.
Additionally I would also like to prevent the "somestuff" entries from being added to the DB.
"1358249984","1358254079","somestuff","1004918400","ut","ut1","name"
"1358254080","1358258175","somestuff","1234742400","at","at1","name1"Maybe someone knows a way how to do it in one step? Or mabye there is a way to define a seperator and characters to drop?Oh.. and another question.... will the importer ignore comment lines automatically (like #this is a comment, etc)? If not, I'll have to preparse the whole file before importing anyway...