How to disable autofilter in openpyxl tables?

Viewed 654

When I create a table using openpyxl, it adds an auto filter by default on all columns. The behavior is reproducible using the example provided in the documentation. I would like to display the tables without the auto filter.

This behavior is controlled by the autoFilter parameter in the class openpyxl.worksheet.table.Table. I have tried setting it to None, as well as different values for the filterColumn parameter in the class openpyxl.worksheet.filters.AutoFilter however, nothing seems to work.

Has anyone been able to disable the auto filter?

2 Answers

This did the trick for me:

ws2.auto_filter.add_sort_condition(None)

ws2 is the name of of my worksheet, I hope this helps.

Related