Search code examples
pythonexcelexcel-formulaxlsxwriter

Python xlsxwriter VLOOKUP in German Excel


I trying for hours to get my VLOOKUP working.

This is an example for an working VLOOKUP before.

=SVERWEIS(E3;Tabelle2!$C$1:$ZZ$5000;117;0)

I generated the xlsx File with Python XLSWriter. With the following options:

        worksheet.protect(
            # password=PASSWORD_BLATTSCHUTZ,
            options={
                "objects": False,
                "scenarios": False,
                "format_cells": True,
                "format_columns": True,
                "format_rows": False,
                "insert_columns": False,
                "insert_rows": False,
                "insert_hyperlinks": True,
                "delete_columns": False,
                "delete_rows": False,
                "select_locked_cells": True,
                "sort": True,
                "autofilter": True,
                "pivot_tables": False,
                "select_unlocked_cells": True,
            }
        )

Solution

  • The problem was not with the german or english excel version.

    The type of the cell must be "STANDARD" not "Text" or anything else. Otherwise it won't detect your excel commands.

    To do this you just need to overwrite anycell with the following option:

    text_format = workbook.add_format()
    text_format.set_num_format("@")
    
    worksheet.write(i + STARTROW, j, content, text_format)...