Page 1 of 1

Having trouble importing a tab delimited file

Posted: Mon May 12, 2008 11:24 am
by thinkadvertising
I'm having a hard time importing a tab delimited file. I get an error when I try to write the line to my table. I'm told that the column count doesn't match the value count. I output the column count for the row and the number matches what I've got in my table (83 columns in both).

Now, this data is formatted kind of strangely. There are multiple tabs in a row (right next to each other). This isn't just a null field, but just extra tabs. For example, there is a field for annual taxes, then the next field is for property options. There is no data in between those two pieces of data. However, there are 12 blank columns when I open that file up in Excel. I'm guessing that means there are 12 tabs right there. To get around this strange formatting, I added blank fields in my table (blank1, blank2, etc). I was getting the column count and value count don't match error, and though this might fix it.

It didn't. I have 83 columns and values (it seems), but I still get that error. I tried importing the file with phpmyadmin, to see if it would work. But I get the same error. Can anyone help me out here? I've tried using the fgetcsv() function and I just can't get it to work. Help.

Re: Having trouble importing a tab delimited file

Posted: Fri May 16, 2008 1:14 am
by rvijay_eee
Open it in excel and save it in csv format. In csv format, fields will be enclosed by double qoutes and separated by commas.

So there wont be any problem in importing the file