I have a QGIS (3.44) project containing a composer. In this composer i inserted an attribute table (which i've given the item_id 'tab').

I would like to be able to access this attribute table properties using PyQgis. I'm using the following code so far :

projectInstance = QgsProject.instance()
projectLayoutManager = projectInstance.layoutManager()

The last line returns a QgsLayoutFrame which is a bit misleading for me ...

How can i 'browse' the content of this QgsLayoutFrame to reach my attribute table ?

1 Answer 1


you need acces to QgsLayoutMultiFrame object.

Example code with some extras

# Table Sample
tabla = layout.itemById('tabla')
tabla_item = tabla.multiFrame ()      

column_0 = tabla_item.columns()[0]
# Change heading name column 0
column_0.setHeading("New name 0")

column_1 = tabla_item.columns()[1]
# Change heading name column 1
column_1.setHeading("New name 1")
# Change order column 0
  • Thanks a lot ... I was completely unable to find that in the API doc. ... Hard to understand the 'meaning' of some classes ... or did u use any other ressource to find that ?
    – Snaileater
    Apr 28, 2019 at 17:45
  • Your welcome ! Nope, I just use the API documentation
    – Fran Raga
    Apr 28, 2019 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.