Hidden columns showing hidden in Excel... but not LibreOffice

Issue #1259 closed
Luc Lalonde created an issue

I have an existing XLSX workbook with multiple sheets. This short script cycles through all the worksheets and hides columns 'F' and 'G':

!/usr/bin/python3

import openpyxl from openpyxl import load_workbook

workbook = load_workbook('Example.xlsx') sheets = workbook.sheetnames workbook.close

for wname in sheets: wb = load_workbook('Example.xlsx') ws = wb[wname] wb.active = ws for tempwname in sheets: if tempwname != wname and tempwname != "Code_cat_perso": del wb[tempwname] if tempwname == wname and tempwname != "Code_cat_perso": for col in ['F', 'G']: ws.column_dimensions[col].hidden= True outputname = "tmp-"+ wname + ".xlsx" wb.save(outputname) wb.close

I want to create separate workbooks for each worksheet... except for the worksheet named 'Code_cat_perso' with columns 'F' and 'G' hidden.

The workbooks are created... one for each worksheet. But for some reason, the two columns are only hidden if I read them with Excel 2016. In LibreOffice 6.2.2, the columns are not hidden.

Am I doing something wrong? Or is this just a LibreOffice bug and I'm not posting this in the proper place?

Comments (2)

  1. Luc Lalonde reporter

    I think that this is not due to a bug in 'openpyxl' or 'LibreOffice'. I cannot reproduce this issue with another XLSX file with similiar worksheets. Could it be that the XLSX is corrupt? Anyway, I'm going to close this issue.

  2. Log in to comment