I've been searching the internet for a while now trying to look for a way to merge all the shapefiles from a directory (a folder) into a single shapefile. I found many solutions but none of them seem to work for one reason or the other. I've found solutions using ArcPy but those solutions are currently out of my reach as I do not own such software.

QGIS might say "Error: Algorithm not found" even though I followed various guides telling me how to fix that. Or it says "Error: wrong number of parameters" when I use algorithms like the processing.runalg(saga:mergelayers"...) one.

I suspect the problem is that the version I am using does not contain the processing algorithms I was suggested, but this is just a guess. I am currently using v2.14.0... a lot of the documentation guiding me seems to be referring to v2.6 or v2.8 but I can't download those.

Can someone help me merge shapefiles from a folder into a single shapefile, using PyQGIS v2.14.0?

1 Answer 1


Yes, the documentation needs updating as the SAGA function you are referring to has become saga:mergelayers (previously, it was saga:mergeshapeslayers):

ALGORITHM: Merge layers
    INPUT <ParameterMultipleInput>
    SRCINFO <ParameterBoolean>
    MATCH <ParameterBoolean>
    MERGED <OutputVector>

So you can use the following to merge your shapefiles from a specified folder:

import glob, processing

path = "C:/Users/You/Desktop/test/"
files = glob.glob(path + "*.shp")
output = path + "merged.shp"

processing.runandload("saga:mergelayers", files, True, True, output)
  • 2
    @Complete_GIS_noob - Awesome, glad it works =)
    – Joseph
    Jul 8, 2016 at 8:20

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.