Skip to content
Snippets Groups Projects
Commit a1d24974 authored by Brad Payne (Vir Linden)'s avatar Brad Payne (Vir Linden)
Browse files

SL-13705 - lock all columns except C in the excel file (apparently google...

SL-13705 - lock all columns except C in the excel file (apparently google sheets does not respect this setting on import)
parent 822a4fb7
No related branches found
No related tags found
No related merge requests found
...@@ -235,14 +235,18 @@ def save_as_excel(data, lang): ...@@ -235,14 +235,18 @@ def save_as_excel(data, lang):
workbook = writer.book workbook = writer.book
worksheet = writer.sheets['Sheet1'] worksheet = writer.sheets['Sheet1']
cell_format = workbook.add_format({'text_wrap': True}) wrap_format = workbook.add_format({'text_wrap': True})
wrap_unlocked_format = workbook.add_format({'text_wrap': True, 'locked': False})
# Translators primarily care about columns A-C
worksheet.set_column('A:C', 100, cell_format) # Translators primarily care about columns A-C, and should write
worksheet.set_column('D:D', 50, cell_format, {'hidden': True}) # only in column C. Can hide the others. Set widths.
worksheet.set_column('E:F', 30, cell_format, {'hidden': True}) worksheet.protect()
worksheet.set_column('A:B', 100, wrap_format)
# Lock the column header in place while scrolling worksheet.set_column('C:C', 100, wrap_unlocked_format)
worksheet.set_column('D:D', 50, wrap_format, {'hidden': True})
worksheet.set_column('E:F', 30, wrap_format, {'hidden': True})
# Lock the top row (column headers) in place while scrolling
worksheet.freeze_panes(1, 0) worksheet.freeze_panes(1, 0)
writer.save() writer.save()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment