# ,xls to .csv adn import to phpmyadmin



## AAOExpert (Dec 13, 2005)

Here is my csv file


```
ID,DistrictTag,SerialNumber,ItemName,Type,Type1,Model,month,day,year,DateofPurchase,Grant,Building,Room,Status,Specs,WorkedOn,Surplus,
,987654321,987654321,Test Item 2,Laptop,N/A,HP,1,22,2008,1/22/2008,N/A,WASHS,203,In Use,N/A,No,No,
```
I am getting the following error
Invalid field count in CSV input on line 1.

I have the correct number of fields and what not.

ID is auto incrementing


----------



## amanxman (Mar 28, 2006)

AAOExpert said:


> I have the correct number of fields and what not.


If you're getting that error, then you don't have correct number of fields... double, triple check.

In fact, looking at csv, it might be due to the date field having slashs in...

1/22/2008
and 
N/A (twice)

the / might be read by the import as a line break, or something similar which is messing with your import...

Firstly try importing data just as 12208 (i.e. no /) and also NA isntead of N/a (twice). If that works, then sweet... we know what's wrong..

But then I guess you need to import all your data with the /. You'll probably need to put some sort of delimiters around each / so the import knows they are to be imported as is...

I'm not sure the formatting so I would recommend:


Import your data WITHOUT the slashes
Presuming that works, within the database (use the phpadmin or whatever front end you have), change the date field contents from 12208 to 1/22/08 (i.e. amend the record so it's what you want.
Then EXPORT the data from myphpadmin, and take a look at the result to see what delimiters are used to maintain the slash in the field.
Then apply those delimiters to your import.

You'll need to delete the records you imported for the test otherwise you'll get errors on duplicated records.

Other option is import all without slashes and then manually edit them. Depends how big database is.

And all this assumes the slash is the problem

Let me know if it is....!


----------



## AAOExpert (Dec 13, 2005)

```
"","987654321","987654321","TestItem3","Desktop","N/A","HP","1","22","2008","1/22/2008","N/A","WASHS","202","End of Life (EOL)","N/A","Yes","Yes"
"","765438764","765438764","TestItem4","Monitor","N/A","HP","1","22","2008","1/22/2008","N/A","WASHS","202","End of Life (EOL)","N/A","Yes","Yes"
```
now it is working with that. i will be testing it again here soon


----------

