Skip to content

Instantly share code, notes, and snippets.

@categulario
Created January 9, 2019 16:51
Show Gist options
  • Save categulario/4b61b87b50ece5f0cea15b659b8ee8fc to your computer and use it in GitHub Desktop.
Save categulario/4b61b87b50ece5f0cea15b659b8ee8fc to your computer and use it in GitHub Desktop.
QGis python script that exports all layers to CSV in the given directory
import os
dirname = "/tmp/csv" # adjust this
for vLayer in iface.mapCanvas().layers():
QgsVectorFileWriter.writeAsVectorFormat(
vLayer,
os.path.join(dirname, vLayer.name() + ".csv"),
"utf-8",
vLayer.crs(),
"CSV"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment