简体   繁体   中英

xlsxwriter set_column to hide doesn't work

I'm trying to hide a column with XlsxWriter but it seems not working. The function returns 0 that means that the column has been hided with success.

I'm using column with number and not with letter.

workbook.get_worksheet_by_name('SENSORS').set_column(5,5, None, None, {'hidden': 1})

However, the columns don't be hide. Why the statement doesn't work?

Thanks in advance.

It should work. Here is a simple example based on your snippet:

import xlsxwriter

workbook = xlsxwriter.Workbook('test.xlsx')
worksheet = workbook.add_worksheet('SENSORS')

workbook.get_worksheet_by_name('SENSORS').set_column(5, 5, None, None, {'hidden': 1})

for col_num in range(8):
    worksheet.write(0, col_num, col_num)

workbook.close()

Output, note that column 5 is hidden.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM