I have 39 different .shp files of the same locations but different data values and I need to output a map for each of them. Is there a way to build a map template and then run a process that will loop through each .shp file and output a map, either .pdf or .png, of the map template with the individual .shp files?
you can achieve this with the atlas function of QGIS. Let's say you have different themes with names 1..n. Then you have to make an additional pointtheme to control the atlas, e.g. called 'control'. Just put one point for each theme on the same coordinates into the control layer (copy and paste the same point from 1..n). Then put all the names of your 39 themes into the control layer into an attribute column. Then make an ATLAS with your maplayout and set the controllayer to your layer 'control'
At least use the data defined override to control the visiblity of the layers through our control layer. Just put the column name (in this example it is called ID, together with the atlasfeature into the expression builder: