[Python] Is it possible to generate an Excel with Slicers with Python? And with the XlsxWriter...

Discussão em 'Python' iniciado por Stack, Maio 21, 2025.

  1. Stack

    Stack Membro Participativo

    I would like to be able to incorporate Slicers (access buttons to column filtering options) in the Excel sheet from python code.

    Would there be any way?

    I would like to start from this code:

    import xlsxwriter

    workbook = xlsxwriter.Workbook('tables.xlsx')
    worksheet = workbook.add_worksheet()

    data = [
    ['Apples', 10000, 5000, 8000, 6000],
    ['Pears', 2000, 3000, 4000, 5000],
    ['Bananas', 6000, 6000, 6500, 6000],
    ['Oranges', 500, 300, 200, 700],

    ]

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

    workbook.close()


    Thanks in advance.

    Continue reading...

Compartilhe esta Página