openpyxl.worksheet.filters module
- class openpyxl.worksheet.filters.AutoFilter(ref=None, filterColumn=(), sortState=None, extLst=None)[source]
Bases:
Serialisable
- add_filter_column(col_id, vals, blank=False)[source]
Add row filter for specified column.
- Parameters:
col_id (int) – Zero-origin column id. 0 means first column.
vals (str[]) – Value list to show.
blank (bool) – Show rows that have blank cell if True (default=``False``)
- add_sort_condition(ref, descending=False)[source]
Add sort condition for cpecified range of cells.
- Parameters:
ref (string, is the same as that of the filter) – range of the cells (e.g. ‘A2:A150’)
descending (bool) – Descending sort order (default=``False``)
- extLst
Values must be of type <class ‘openpyxl.descriptors.excel.ExtensionList’>
- filterColumn
A sequence (list or tuple) that may only contain objects of the declared type
- ref
- sortState
Values must be of type <class ‘openpyxl.worksheet.filters.SortState’>
- tagname = 'autoFilter'
- class openpyxl.worksheet.filters.ColorFilter(dxfId=None, cellColor=None)[source]
Bases:
Serialisable
- cellColor
Values must be of type <class ‘bool’>
- dxfId
Values must be of type <class ‘int’>
- tagname = 'colorFilter'
- class openpyxl.worksheet.filters.CustomFilter(operator=None, val=None)[source]
Bases:
Serialisable
- operator
Value must be one of {‘equal’, ‘greaterThan’, ‘notEqual’, ‘lessThan’, ‘greaterThanOrEqual’, ‘lessThanOrEqual’}
- tagname = 'customFilter'
- val
Values must be of type <class ‘float’>
- class openpyxl.worksheet.filters.CustomFilterValueDescriptor(*args, **kw)[source]
Bases:
Convertible
Excel uses wildcards for string matching
- expected_type
alias of
float
- pattern = re.compile('\\d+|^\\*.+|^.+\\*$')
- class openpyxl.worksheet.filters.CustomFilters(_and=False, customFilter=())[source]
Bases:
Serialisable
- customFilter
A sequence (list or tuple) that may only contain objects of the declared type
- tagname = 'customFilters'
- class openpyxl.worksheet.filters.DateGroupItem(year=None, month=None, day=None, hour=None, minute=None, second=None, dateTimeGrouping=None)[source]
Bases:
Serialisable
- dateTimeGrouping
Value must be one of {‘year’, ‘minute’, ‘second’, ‘hour’, ‘month’, ‘day’}
- day
Values must be of type <class ‘float’>
- hour
Values must be of type <class ‘float’>
- minute
Values must be of type <class ‘float’>
- month
Values must be of type <class ‘float’>
- second
Values must be of type <class ‘int’>
- tagname = 'dateGroupItem'
- year
Values must be of type <class ‘int’>
- class openpyxl.worksheet.filters.DynamicFilter(type=None, val=None, valIso=None, maxVal=None, maxValIso=None)[source]
Bases:
Serialisable
- maxVal
Values must be of type <class ‘float’>
- maxValIso
Values must be of type <class ‘datetime.datetime’>
- tagname = 'dynamicFilter'
- type
Value must be one of {‘lastYear’, ‘Q3’, ‘nextMonth’, ‘M3’, ‘thisMonth’, ‘M9’, ‘thisYear’, ‘thisWeek’, ‘today’, ‘yearToDate’, ‘yesterday’, ‘lastMonth’, ‘Q4’, ‘M2’, ‘tomorrow’, ‘M12’, ‘M4’, ‘Q1’, ‘nextYear’, ‘nextWeek’, ‘Q2’, ‘lastQuarter’, ‘lastWeek’, ‘M8’, ‘aboveAverage’, ‘M6’, ‘thisQuarter’, ‘M1’, ‘M10’, ‘M5’, ‘nextQuarter’, ‘null’, ‘M7’, ‘M11’, ‘belowAverage’}
- val
Values must be of type <class ‘float’>
- valIso
Values must be of type <class ‘datetime.datetime’>
- class openpyxl.worksheet.filters.FilterColumn(colId=None, hiddenButton=False, showButton=True, filters=None, top10=None, customFilters=None, dynamicFilter=None, colorFilter=None, iconFilter=None, extLst=None, blank=None, vals=None)[source]
Bases:
Serialisable
- colId
Values must be of type <class ‘int’>
- col_id
Aliases can be used when either the desired attribute name is not allowed or confusing in Python (eg. “type”) or a more descriptive name is desired (eg. “underline” for “u”)
- colorFilter
Values must be of type <class ‘openpyxl.worksheet.filters.ColorFilter’>
- customFilters
Values must be of type <class ‘openpyxl.worksheet.filters.CustomFilters’>
- dynamicFilter
Values must be of type <class ‘openpyxl.worksheet.filters.DynamicFilter’>
- extLst
Values must be of type <class ‘openpyxl.descriptors.excel.ExtensionList’>
- filters
Values must be of type <class ‘openpyxl.worksheet.filters.Filters’>
Values must be of type <class ‘bool’>
- iconFilter
Values must be of type <class ‘openpyxl.worksheet.filters.IconFilter’>
- showButton
Values must be of type <class ‘bool’>
- tagname = 'filterColumn'
- top10
Values must be of type <class ‘openpyxl.worksheet.filters.Top10’>
- class openpyxl.worksheet.filters.Filters(blank=None, calendarType=None, filter=(), dateGroupItem=())[source]
Bases:
Serialisable
- blank
Values must be of type <class ‘bool’>
- calendarType
Value must be one of {‘saka’, ‘hijri’, ‘gregorian’, ‘taiwan’, ‘korea’, ‘gregorianXlitFrench’, ‘thai’, ‘gregorianMeFrench’, ‘japan’, ‘hebrew’, ‘gregorianXlitEnglish’, ‘gregorianUs’, ‘gregorianArabic’}
- dateGroupItem
A sequence (list or tuple) that may only contain objects of the declared type
- filter
A sequence of primitive types that are stored as a single attribute. “val” is the default attribute
- tagname = 'filters'
- class openpyxl.worksheet.filters.IconFilter(iconSet=None, iconId=None)[source]
Bases:
Serialisable
- iconId
Values must be of type <class ‘int’>
- iconSet
Value must be one of {‘3Symbols2’, ‘5ArrowsGray’, ‘4Arrows’, ‘3Signs’, ‘5Arrows’, ‘3Arrows’, ‘5Quarters’, ‘4RedToBlack’, ‘4TrafficLights’, ‘3ArrowsGray’, ‘3Symbols’, ‘4ArrowsGray’, ‘3TrafficLights2’, ‘3TrafficLights1’, ‘3Flags’, ‘4Rating’, ‘5Rating’}
- tagname = 'iconFilter'
- class openpyxl.worksheet.filters.SortCondition(ref=None, descending=None, sortBy=None, customList=None, dxfId=None, iconSet=None, iconId=None)[source]
Bases:
Serialisable
- customList
Values must be of type <class ‘str’>
- descending
Values must be of type <class ‘bool’>
- dxfId
Values must be of type <class ‘int’>
- iconId
Values must be of type <class ‘int’>
- iconSet
Value must be one of {‘3Symbols2’, ‘5ArrowsGray’, ‘4Arrows’, ‘3Signs’, ‘5Arrows’, ‘3Arrows’, ‘5Quarters’, ‘4RedToBlack’, ‘4TrafficLights’, ‘3ArrowsGray’, ‘3Symbols’, ‘4ArrowsGray’, ‘3TrafficLights2’, ‘3TrafficLights1’, ‘3Flags’, ‘4Rating’, ‘5Rating’}
- ref
- sortBy
Value must be one of {‘value’, ‘cellColor’, ‘icon’, ‘fontColor’}
- tagname = 'sortCondition'
- class openpyxl.worksheet.filters.SortState(columnSort=None, caseSensitive=None, sortMethod=None, ref=None, sortCondition=(), extLst=None)[source]
Bases:
Serialisable
- caseSensitive
Values must be of type <class ‘bool’>
- columnSort
Values must be of type <class ‘bool’>
- extLst
Values must be of type <class ‘openpyxl.descriptors.excel.ExtensionList’>
- ref
- sortCondition
A sequence (list or tuple) that may only contain objects of the declared type
- sortMethod
Value must be one of {‘stroke’, ‘pinYin’}
- tagname = 'sortState'
- class openpyxl.worksheet.filters.Top10(top=None, percent=None, val=None, filterVal=None)[source]
Bases:
Serialisable
- filterVal
Values must be of type <class ‘float’>
- percent
Values must be of type <class ‘bool’>
- tagname = 'top10'
- top
Values must be of type <class ‘bool’>
- val
Values must be of type <class ‘float’>