Is there a way to choose the field delimiter when exporting a CSV with geometry as wkt in QGIS?

I have a shapefile with donut holes and I'd like to export it as a CSV. It's for a partner whose DB doesn't support spatial data.

I followed Greg Krakow's methodology to add a WKT field to my exported file (when exporting to csv, add GEOMETRY=AS_WKT in the "Layer" field, but the exported field delimiter is a comma: CSV with WKT field

The problem is that each coordinate pairs of my polygons (and I suspect it will be the same for lines) are separated by a comma too so I can't import the data back into QGIS

With point shapefile, it works like a charm.

Does anyone know if I can choose my field delimited when exporting to CSV? Choose a semicolon for instance?

I search on the web and QGIS's documentation but didn't find anything.

  • 2
    Have you checked the help page yet: gdal.org/ogr/drv_csv.html. It describes how to change the separator.
    – underdark
    Dec 4, 2012 at 16:43
  • I was looking for QGIS specifically... didn't think of looking for GDAL's help. Thanks!!
    – fgcarto
    Dec 4, 2012 at 18:36

2 Answers 2


I was able to export to CSV, using other than a comma, by separating the layer creation options in the Save As.. dialog with linebreaks.

Neither comma, nor space-separating them (even when they were in quotes) worked, but the linebreaks did the trick. To emphasize..

THIS APPROACH WORKED (linebreak-separated):


But these approaches did NOT work...

(space-separated options):


(comma-separated options):


(quoted, and either space or comma-separated LCOs):


As @underdark noted, there are some additional options discussed on the OGR CSV driver page you may want to be aware of. Specifically, the SEPARATOR parameter will accept either SEMICOLON or TAB in addition to COMMA. Also, you may want to experiment with the LINEFORMAT parameter, which supports either CRLF (dos/windows) or LF (unix).

A picture says a thousand words, so here's a screen grab. :)

enter image description here

  • Thanks! It's working. I don't know why though, but when I try to import my csv into QGIS, it says that it's not a valid layer and it can be added to the map...? I tried with a simple polygon (linestring and polygon) and it didn't work neither :( So I guess it's another question now... ;)
    – fgcarto
    Dec 4, 2012 at 18:29
  • ...interesting. I'm not sure how to explain that. I tried adding the one I created to the map and it worked. Then I tried adding a new one, as it created it (i.e. via the "Add saved file to map" option), and it also worked. What version of QGIS? 1.8?
    – elrobis
    Dec 4, 2012 at 18:57
  • 1.8.0-Lisboa. It's working when I use the "Add saved file to map", not when I use the "Add delimited text layer" button. The semicolon delimiter is check as well as my field "WKT" selected for the geometry... It worked with a point layer earlier though...
    – fgcarto
    Dec 4, 2012 at 19:10
  • 1
    Ahh.. try going through the "Add Vector Layer.." button (like you would to add a shapefile), then browse into the folder with your .csv. At the bottom of the "Open OGR Supported Vector Layer" dialog, set "Files of type:" to Comma Separated Value [OGR]. Then your .csv should appear, and I bet it'll work.
    – elrobis
    Dec 4, 2012 at 19:15
  • You bet right! It worked with the "Add delimited text layer" after I opened my csv in Excel and resaved it too... Strange, but if it's working with the "Add Vector Layer" button, I'm ok with that. Strange behavior though...
    – fgcarto
    Dec 4, 2012 at 19:22

Settings for QGIS 3 using "Layer Options":

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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