close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Importing CSV

Thread began 2/21/2010 8:54 am by balexander389215 | Last modified 2/21/2010 2:18 pm by balexander389215 | 1629 views | 4 replies |

balexander389215

Importing CSV

Okay, it's official, I'm hopeless, but then you already knew that having answered some of my earlier questions.

I'm setting up a store, first on my test server. Everything was okay to the point of adding products. I have a csv of roughly 5000 items. I made sure that the column names matched the table names, (ProductID, ProductSKU, etc.) and hit import. I kept getting "Invalid field count in CSV input on line 1". Not to be undone I tried importing using, "CSV using LOAD DATA" and put all the column names in, separated by a comma of course. That did something. I now had a table of about 1700 lines except most of the cells are empty. Every so often however, in the ProductSKU table there is a piece of the product description. This same piece of description appears in the product name section.

I thought I'd try importing again and now I have 3400 lines, the 2nd 1700 duplicating the 1st 1700 which gives me a really screwed up database.

Any ideas on where I went wrong and how I fix this. I would like to get all 5000 items into the database with all the information in the correct places. I wouldn't mind getting the 5000 images in there as well.

Thanks

Brian

Sign in to reply to this post

balexander389215

Importing CSV Continued

I'm still working at this thing. I thought I'd try just to import one column, so I set up a csv for and imported ProductSKU and lo and behold all 5574 records appeared in the table. I thought I was off to a good start so I then tried the next column. The darn thing would only add to at record number 5575, there's no way I could reset it to have the imported records start at column 1 in the table. Grrr, So one column out of 8 in, I sure don't look forward to trying to do this by hand.

Sign in to reply to this post

mrs

Back your DB up and then try and import all info in one go... otherwise you are going to have to write an sql query which in laymans terms does this...

Look for SKU code 101010 and insert Product Name... Look for SKU code 101011 and insert Product Name... Look for SKU code 101012 and insert Product Name... and so on.

Basically, you've got to match an existing records content to the incoming content in order for it to be placed in the correct record.

So, as I say, you are probably best to start again with all content coming in at once.

Sign in to reply to this post

balexander389215

Yup did that

Actually I did try to import the whole thing all in one go, several time and in several different ways and could not get it to work. As I said in the first post it only brought down 1734 records, populated only random cells and with the wrong data, stuff that should have been two or three cells over. Through experimentation I discovered that if I did one column it worked but I could not find a way to get the second column in. But doing the whole thing produced nothing. Back to the drawing board.

Sign in to reply to this post

balexander389215

Got It

I got it, I just had to keep trying. Just so you know, in the, 'import, csv using load data,' it uses a semicolon by default for the, 'Fields Terminated By' value. As soon as I saw that I changed it to a comma and everything came in. Now to figure out how to get all the images in. I still have to move everything to the proper category but at least I don't have to enter 5500 items.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...