I have a script that adds filters to an xlsx file. I can filter out everything except the given value but is there a way to do the opposite? In what I have so far, the [0]
filters everything else out, but I want to filter the 0
values out instead. Is there a NOT
operator I can use to make this happen?
from openpyxl import load_workbook
wb = load_workbook("Report.xlsx")
ws = wb.active
ws.auto_filter.ref = ws.dimensions
ws.auto_filter.add_filter_column(6, [0])
wb.save("filtered.xlsx")
I've also tried saving the entire column into a list and taking out the 0
but one of the cells contains a 0.00001
which gets stored as 1e-05
and that won't be caught either.
question from:
https://stackoverflow.com/questions/65839860/how-to-auto-filter-column-in-openpyxl-with-a-not-value 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…