Turn off filter button

227 views
Skip to first unread message

Iain Delaney

unread,
Sep 8, 2019, 2:53:58 PM9/8/19
to openpyxl-users
When I create a new table, it creates the header row, but adds the filter buttons to each item in the header row by default. This causes a problem for me, as I am trying to import the xlsx file in FileMaker Pro, and it can't handle the filter buttons. If I open the spreadsheet in Excel first, go to the 'Tables' tab, and turn off the 'filter buttons' checkbox, then I can import the file, but of course I would prefer not to have to do that with every spreadsheet I export.
So, is there any way I can specify that filter buttons should not be created, or filter buttons should be turned off?

Thanks.

Charlie Clark

unread,
Sep 10, 2019, 12:28:48 PM9/10/19
to openpyxl-users
Unfortunately, sometimes the only way to solve this is to look at the
XML that Excel generates. In this case it looks like you have to set
"hiddenButton" = True for every column, though I suspect autoFilter =
True should also work.

This is the source from a file generated with Excel 2016 with the
filters disabled.

<x:table id="1" name="Tabelle1" displayName="Tabelle1" ref="A2:F10"
totalsRowShown="0"
xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<x:autoFilter ref="A2:F10">
<x:filterColumn colId="0" hiddenButton="1" />
<x:filterColumn colId="1" hiddenButton="1" />
<x:filterColumn colId="2" hiddenButton="1" />
<x:filterColumn colId="3" hiddenButton="1" />
<x:filterColumn colId="4" hiddenButton="1" />
<x:filterColumn colId="5" hiddenButton="1" />
</x:autoFilter>
<x:tableColumns count="6">
<x:tableColumn id="1" name="Spalte1" />
<x:tableColumn id="2" name="Spalte2" />
<x:tableColumn id="3" name="Spalte3" />
<x:tableColumn id="4" name="Spalte4" />
<x:tableColumn id="5" name="Spalte5" />
<x:tableColumn id="6" name="Spalte6" />
</x:tableColumns>
<x:tableStyleInfo name="TableStyleMedium2" showFirstColumn="0"
showLastColumn="0" showRowStripes="1" showColumnStripes="0" />
</x:table>

--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Kronenstr. 27a
Düsseldorf
D- 40217
Tel: +49-211-600-3657
Mobile: +49-178-782-6226

Iain Delaney

unread,
Sep 10, 2019, 5:45:21 PM9/10/19
to openpyxl-users
Okay, thanks for the info. I'll experiment a bit with the two options. Since this is a one-time conversion, it may be easiest just to fix the file in Excel.
Again, thanks for your help.
Reply all
Reply to author
Forward
0 new messages