[Python] Save changes with openpyxl

Discussão em 'Python' iniciado por Stack, Abril 6, 2025.

  1. Stack

    Stack Membro Participativo

    I am new to python and an using openpyxl to edit an xlsx file. I am having an issue trying to save the original file. It seems that openpyxl keeps making me save the changes as a new xlsx.

    Here is the code I am using and get the error TypeError: save() takes exactly 2 arguments (1 given)

    import openpyxl
    from openpyxl import Workbook
    wb = openpyxl.load_workbook('book1.xlsx')
    sheet = wb.get_sheet_by_name("Sensor Status")
    sheet['I3'] = '=countifs(B:B,"*server*",C:C,"=0")'
    sheet['I4'] = '=countifs(B:B,"*server*",C:C,">=0")'
    wb.save()

    Continue reading...

Compartilhe esta Página