Openpyxl module returns 0 tables in the excel spreadsheet

Viewed 36

I am trying to extract all tables from spreadsheet that contains multiple tables in each sheet.

But the following piece of code return 0 Tables in all worksheets.

Am i missing something here? Please suggest a workaround.

from openpyxl import load_workbook
wb = load_workbook(filename = '/Downloads/asd.xlsx')
for ws in wb.worksheets:
    print(len(ws.tables)) # prints 0
1 Answers

In answer to your question 'Am i missing something here', the code should work if there are in fact tables in the workbook.

Related