CSV file import problem

Permalink Browser Info Environment
When uploading my csv file I get the following message:


The following errors occurred when attempting to process your request: Error on line 17: Number of fields don't match

but it's the sample/ template csv file from the DL block that's been populated. I haven't added or removed any columns. What happens is the first 17 entries get in the system and then all works well with the maintenance/ google part. In this way I have to upload the whole lot (there are about 300 dealers in my list) in chunks of 17. I realise it's probably something to do with the database but haven't got a clue how to fix this.

Type: Discussion
Status: New
MAKG
View Replies:
GregJoyce replied on at Permalink Reply
GregJoyce
Perhaps you're getting an Apache timeout or something? Can we have a look at your environment info?
It's in the dashboard at "Sitewide Settings > Debug"
MAKG replied on at Permalink Reply
MAKG
Thanks for the prompt reply - here's my environment info:


# concrete5 Version
5.4.1.1

# Server Software
Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635

# Server API
cgi

# PHP Version
5.2.16
GregJoyce replied on at Permalink Reply
GregJoyce
yeah that looks about right, can you get me the csv?
MAKG replied on at Permalink Reply 2 Attachments
MAKG
I tried saving to both mac & pc versions from Excel 2007 and 2003 (patched to support higher versions). I also tried online converters – same outcome.
I upload the file and first 17 entries (including headings) get in. Then I go back to excel, delete the top 17 and re-save, append the updated csv file and so it goes until the whole list is uploaded – then run the maintenance job to register locations with Google.

Thing is though, when I export the list from the block I can upload it back with no errors as long as there are no changes done to it.

Attached is the original csv and one exported from the block – again, if I don’t re-save it there are no problems uploading the whole file in one go.
GregJoyce replied on at Permalink Reply
GregJoyce
When you open the files in a standard text editor, it looks like you have some line breaks in there. That can louse up a CSV file because it's expecting the data to be
data,more data
new,stuff

so a file like
data,more
data
new,stuff


Can make the stuff look like a new entry. The exported version has quoted cells so that one imported without any problems. I think spreadsheet programs will give you the option of quoting your cells on csv export.
MAKG replied on at Permalink Reply
MAKG
Thanks Greg. After searching for 3 hrs I finally found the right excel macro that does the job

Public Sub OutputQuotedCSV()
        Const QSTR As String = """"
        Dim myRecord As Range
        Dim myField As Range
        Dim nFileNum As Long
        Dim sOut As String
        nFileNum = FreeFile
        Open "File1.txt" For Output As #nFileNum
        For Each myRecord In Range("A1:A" & _
                    Range("A" & Rows.Count).End(xlUp).Row)
            With myRecord
                For Each myField In Range(.Cells(1), _
                            Cells(.Row, 256).End(xlToLeft))
                    sOut = sOut & "," &QSTR & _
                        Replace(myField.Text, QSTR, QSTR & QSTR) & QSTR
GregJoyce replied on at Permalink Reply
GregJoyce
Yikes, good find though!
FatTony1952 replied on at Permalink Reply
FatTony1952
I'm trying to run a macro on my file to fix this same issue. What is the name of that macro? Excel won't let me just past a macro into the editor.
FatTony1952 replied on at Permalink Reply
FatTony1952
Scratch that. Created a csv through Numbers instead of Excel and it worked.

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.