Importing a database of products from a CSV file

6 posts by 3 authors in: Forums > CMS Builder
Last Post: August 31, 2010   (RSS)

By fsardoni - August 26, 2010

Hi is there a known issue importing a database (products) via phpmyadmin with a .CSV file? Or better yet, is there a particular way that the .CSV file needs to be formatted?
I exported what CMS Builder creates as .CSV and then use that to copy and paste all the rows of my products. Saved it and then re-upload the file to the MySQL db. However I get an error:

Invalid field count in CSV input on line 2.

what's that all about? Any helps as always, is GREATLY Appreciated.

Re: [chris] Importing a database of products from a CSV file

By fsardoni - August 26, 2010

Hi Chris, thanks again for your help.
What I am trying to achieve here is an import of all my products from an existing CSV.

Step 1: From PHPmyAdmin I exported the cms_products table (as a CSV file) to see what columns CMS Builder creates when I created my first product manually.

Step 2: I copied the content from my original "products" CSV into the export CSV file from CMS Builder and then tried to upload it to CMS builder DB.

In short I want to do a quick upload of all my products instead of creating each record (for my products) manually.

Re: [fsardoni] Importing a database of products from a CSV file

By Chris - August 26, 2010 - edited: August 26, 2010

Hi fsardoni,

That sounds reasonable. :)

You'll want to do a CSV export from phpmyadmin to see the format it expects. Then you can munge your CSV file to look like what phpmyadmin expects and import that.
All the best,
Chris

Re: [fsardoni] Importing a database of products from a CSV file

By fsardoni - August 26, 2010 - edited: August 26, 2010

OK. It works with your suggestion of changing the default ";" to ","...

As a note for others, it only works when changing the import from
"CSV" to "CSV using LOAD DATA" and the default "Fields Terminated By" = ";" to =","

Thank you again Chris.

Re: [fsardoni] Importing a database of products from a CSV file

Hi Fsardoni,

If you do a lot of database massaging, you might want to give Navicat for MySQL a look.

http://navicat.com/en/products/navicat_mysql/mysql_overview.html

They offer a free 30 day full version trial and also a free "lite" version of the program.

Best,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php