I am a bit new in python now working in qgis to automates some time. I have an excel pre-written template file where i have to add different data in different columns.
outpufFile = open('d:/template.xlsx','w')
for layer in QgsMapLayerRegistry.instance().mapLayers().values():
print layer.name() +","+ str(layer.featureCount())
line = layer.name()
unicode_line = line.encode('utf-8')
outpufFile.write(unicode_line)
outpufFile.close()
I get this so far but it corrupting my template while I also don't know how to access specific column or row of my file In order to write at exactly column and row to full my template.