473,385 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Importing excel spreadsheet into database

196 100+
I trying to import a excel table into a mysql database table. First thing i did was make colums up according to the colum names in the excel table, then i exported the excel document as a .csv file (comma seperated) i then went to my database and imported the excel document;

Thats when i get this error "Invalid field count in CSV input on line 1",
so i open up the .csv file and look at line 1 -

"Pcode,Locality,State,Comments,DeliveryOffice,Pres ortIndicator,ParcelZone,BSPnumber,BSPname,Category "

this is when i realise that the names in the table don't match that in database, so i then change the names so that they are the same -

"PCODE,LOCALITY,STATE,COMMENTS,DELIVERYOF,PRESORTI ND,PARCELZONE,BSPNUMBER,BSPNAME,CATEGORY"

After this i still get the same error, i then see that for the import u can specify the colum names so i do this and again i get the same error.

So what i want to know is how to fix the error???

Thanks in advanced, your help is greatly appreciated.
Jul 18 '08 #1
4 2381
code green
1,726 Expert 1GB
Have you checked and specified which delimiter you are using?
A CSV ought to be comma delimited but could be semi-colon or tab delimited.
Jul 18 '08 #2
chazzy69
196 100+
Ok i have check the .csv file and everything is seperated by commas. I then double checked the options it was specifying for import and noticed that the some of them won't work with this file.

The options that may be wrong:

Fields terminated by :
Fields enclosed by "
Fields enclosed by \
Lines terminated by auto

How should these be if the file im trying to import has only commas and spaces in it??

Thanks for the reply
Jul 19 '08 #3
chazzy69
196 100+
Ok i just figured out how to get it to work i just replaced all the options with commas and left the last option with auto.

Thanks for giving me the right direction to look into
Jul 19 '08 #4
code green
1,726 Expert 1GB
It was the 'Fields terminated by : ' causing the problem.
As you can see the default is semi colon.
Jul 21 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Little PussyCat | last post by:
Hello, I nee to write something that will transfer excel data into an SQL Server table. I have for another database application I wrote have it importing Excel spreadsheet data using cell by...
9
by: Edward S | last post by:
I budget for a Project in an Excel sheet as illustrated below. The months below are usually a 2 year period i.e. 24 months, though it could be over 24 months depending upon a Project. I then...
2
by: Mr. Bungle | last post by:
When importing excel from access I am fully aware that one can import directly into a table. Can you get as specific via code or something to import data from an excel sheet to a FORM (Not Table)...
2
by: nutthatch | last post by:
I want to be able to import an Excel spreadsheet into Access 2K using the macro command Transferspreadsheet. However, the file I am importing (over which I have no control) contains some records...
9
by: jillandgordon | last post by:
I am trying to import an excel file into Access 97. It looks perfectly all right but, every time I try to import it, I get to the lst step and am told that it was not imported due to an error. ...
1
by: Geoff Jones | last post by:
Hi I have a question which I hope somebody can answer. I have written a VB application with which I want to import an Excel file, analyze the data within it and do some calculations. There are...
2
by: jason.teen | last post by:
Hi, I am having trouble importing a spreadsheet from Excel into an Access Database. I have noticed that even specifying the Cell Type of the Excel Data Cell, When I import it, still get...
3
by: D.Stone | last post by:
I'm trying to import an Excel spreadsheet into an existing Access table using Office 2003. Ultimately, the plan is to do it programmatically using TransferSpreadsheet, but to check that the file...
0
by: DrewYK | last post by:
I have the project that may never end in front of me. I am creating a routine that will take SpreadSheets from Excel and bring them into Access. I am not using any "DoCmd"s because the goal...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.