I have a shape of my city and I have a CSV file, containing attributes I'd like to join into the shape of the city. In selection of the CSV file, I get the following error message by MMQGIS.

enter image description here

Source of the CSV: public server of election data. Things I tried to fing the error:

  • converted the file to UTF-8 encoding
  • converted it to ASCII
  • replaced \n with \r\n
  • replaced ; delimiters with | and ,
  • replaces decimal characters with . and ,
  • open and resave in Libre Office
  • open and resave in Notepad++
  • use CSV lint for verification
  • view the file in Libre Office to compare ammount of columns
  • split the CSV (~30 lines) to merge them step by step to find broken lines
  • found the line where the import seems to break
  • still can't find whats broken in this line

Is it possible that this tool is causing the error itself?

Update: I just skipped the first 5 lines and tried the next 5 lines. Works without error. Maybe it is the length of the lines? Or the total ammount of data in the CSV? That would be odd because it is not much data.

If I merge only a few lines, all other lines with no new CSV attributes disappear from my shapefile.

Shapefile: https://www.offenedaten-wuppertal.de/dataset/40c4cc39-08d2-44df-9257-94edc7af3578/resource/40c4cc39-08d2-44df-9257-94edc7af3578

Example data to merge: (Source: https://wahlen.wuppertal.de/BW2017/05124000/html5/Bundestagswahl355.csv)

06;friedrichsberg;7;7;7150;4912;68.7;4834;78;4855;57;1321;27.33;1182;24.35;1635;33.82;1337;27.54;349;7.22;406;8.36;475;9.83;598;12.32;349;7.22;559;11.51;526;10.88;520;10.71;59;1.22;37;0.76;0;0;15;0.31;114;2.36;58;1.19;0;0;12;0.25;0;0;3;0.06;0;0;8;0.16;6;0.12;4;0.08;0;0;1;0.02;0;0;30;0.62;0;0;8;0.16;0;0;9;0.19;0;0;4;0.08;0;0;10;0.21;0;0;4;0.08;0;0;1;0.02;0;0;44;0.91;0;0;5;0.1; 11;brill-arrenberg;6;6;6141;4697;76.49;4659;38;4670;27;1319;28.31;1155;24.73;1433;30.76;1001;21.43;542;11.63;638;13.66;473;10.15;621;13.3;435;9.34;704;15.07;313;6.72;326;6.98;31;0.67;22;0.47;0;0;4;0.09;105;2.25;70;1.5;0;0;5;0.11;0;0;3;0.06;0;0;4;0.09;8;0.17;7;0.15;0;0;0;0;0;0;21;0.45;0;0;11;0.24;0;0;17;0.36;0;0;3;0.06;0;0;20;0.43;0;0;5;0.11;0;0;4;0.09;0;0;27;0.58;0;0;2;0.04;

  • 1
    Without seeing your CSV file we can't comment. Please share it . However, meantime, if you have text fields check that they don't also contain delimiter characters that are mucking things up. – MappaGnosis Sep 25 '17 at 10:02
  • 1
    Could you post a text string of the line that breaks the import tool? (And perhaps the one before it too) – firefly-orange Sep 25 '17 at 10:03
  • 1
    did you try to open the CSV with QGIS before your join ? Do you have any error ? – Hugo Roussaffa - GeoDatup Sep 25 '17 at 10:04
  • Updated the question – Guido Gallenkamp Sep 25 '17 at 10:14

I opened your csv in a notepad and I can see that a few of your decimals are actually commas e.g. "0,00". Fix these and you should be good to go.

| improve this answer | |
  • This is the german decimal character which works for most imports. Also I converted all the , into . to have the US decimal format. No effect. – Guido Gallenkamp Sep 25 '17 at 12:48
  • I just deleted all 1048 commas so that the only delimiter character left is the semicolon. Still the same error message. – Guido Gallenkamp Sep 25 '17 at 13:07

You must be sure that the csv is encoding in UTF-8 as explain in the documentation

In my case i solved the problem changed the encoding

| improve this answer | |
  • Thank you for your input. As stated above, I already tried that. A am a programmer, so I am well aware of the troubles wrong encoding can do. – Guido Gallenkamp Oct 25 '18 at 11:10
  1. Open your csv-file with Apache-Office.
  2. Replace all german letters ä,ö,ü etc with utf-8 compatible chars.
  3. Make sure all rows have the samt amount of coloums.
  4. Save as csv utf8.

Above steps worked for me with Swedish adress files :-) Good luck

| improve this answer | |

For me the simplest way was to open de xlsx file in Libreoffice (5.4 in my case) and save as CSV. Then a dialog box pops up asking for the Encoding. I selected UTF-8 and it worked!!!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.