xlwings: How to loop through all tables in a workbook?

34 views Asked by At

How can I loop through all tables in a given workbook?

I've found the code to loop through all Pivot Tables in a given worksheet, but cannot find documentation for how to loop through all regular tables in a workbook.

# This works:
for index, table in enumerate (sheet.api.PivotTables()):
    print(table)
# This does not work:
for index, table in enumerate (sheet.api.Tables()):
    print(table)

# Exception has occurred: com_error
# (-2147352570, 'Unknown name.', None, None)
# object has no attribute 'Tables'
0

There are 0 answers