I have an Excel file (with .xlsx extension) containing some non-spatial data that I want to use in combination with some other spatial data.
I generally know how to load an external source (Loading Layers from the PyQGIS Cookbook), but I haven't found any reference for files with .xlsx extension, so I tried to import it in this way:
uri = 'path_to_the_file/test.xlsx' layer = QgsVectorLayer(uri, 'test', 'ogr')
but when I try to read something, for example all the elements from the first column:
for item in layer: print item
I get this error:
'QgsVectorLayer' object is not iterable
What I'm doing wrong? If I previously convert my file to the .csv format, then there is not problem with the reading of the items in PyQGIS, but I would like to know if there is a direct way in order to avoid this passage.