From a1d24974e808c3a0fb6072d010ccabbc38703232 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 14 Sep 2020 20:34:51 +0100 Subject: SL-13705 - lock all columns except C in the excel file (apparently google sheets does not respect this setting on import) --- scripts/code_tools/modified_strings.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'scripts/code_tools') diff --git a/scripts/code_tools/modified_strings.py b/scripts/code_tools/modified_strings.py index b77115ed46..c259a0f984 100644 --- a/scripts/code_tools/modified_strings.py +++ b/scripts/code_tools/modified_strings.py @@ -235,14 +235,18 @@ def save_as_excel(data, lang): workbook = writer.book worksheet = writer.sheets['Sheet1'] - cell_format = workbook.add_format({'text_wrap': True}) - - # Translators primarily care about columns A-C - worksheet.set_column('A:C', 100, cell_format) - worksheet.set_column('D:D', 50, cell_format, {'hidden': True}) - worksheet.set_column('E:F', 30, cell_format, {'hidden': True}) - - # Lock the column header in place while scrolling + 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, and should write + # only in column C. Can hide the others. Set widths. + worksheet.protect() + worksheet.set_column('A:B', 100, wrap_format) + 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) writer.save() -- cgit v1.2.3