Home > Blockchain >  Is it possible to generate an Excel with Slicers with Python? And with the XlsxWriter library?
Is it possible to generate an Excel with Slicers with Python? And with the XlsxWriter library?

Time:05-21

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.

CodePudding user response:

No. That feature isn't supported by XlsxWriter and, due to the relative complexity, it probably won't be in the future.

  • Related