I have dozens of temporary Layers. I'd like to export them all as GeoPackages, but I am unsure how to go about doing so without doing each one individually.
I was reviewing this code Exporting several files at same time in QGIS, but it exports files as .shp.
I have tried changing .shp to .gkpg and ESRI Shapefile to GeoPackage, but the code generated errors.
I did verify, however, that I can get the original code to run:
myDir = 'C:/temp/'
for vLayer in iface.mapCanvas().layers():
QgsVectorFileWriter.writeAsVectorFormat( vLayer,
myDir + vLayer.name() + ".shp", "utf-8",
vLayer.crs(), "ESRI Shapefile" )