jmcnamara / XlsxWriter

A Python module for creating Excel XLSX files.
https://xlsxwriter.readthedocs.io
BSD 2-Clause "Simplified" License
3.65k stars 632 forks source link

feature request: Can you add a slicer when `worksheet.add_table` API #918

Open epver opened 2 years ago

epver commented 2 years ago

Feature Request

image

options = {
    "data": data,
    "slicer": [
        {"column": "Column1", "location": "A1"},
        {"column": "Column2", "location": "C1"},
    ]
}

or 

options = {
    'data': data,
    'columns': [
        {'header': 'Product', 'slicer': 'A1'},
        {'header': 'Quarter 1'},
        {'header': 'Quarter 2'},
        {'header': 'Quarter 3'},
        {'header': 'Quarter 4'},
    ]
}
worksheet.add_table('B3:F7', {options})

In this way, you can initially realize the function of the pivot table.

At present, I think the method is to rewrite the Workbook, Worksheet for simple implementation, but I don't know how to add slicer1.xml file

image

jmcnamara commented 2 years ago

I'll look into it since Slicers are a really nice feature. However, it won't happen in the short term.