I’ve setup a macro on libreoffice calc in python. I have set the macro to run every time the document is opened but I have realised that it changes the save state. That is, if I try to close the file, it asks me to save even if the macro hasn’t made any changes. I’ve made sure to test if the macro is executing setValue but it is not. So, why is libreoffice asking me to save the document despite my macro not making any changes to the document?
My Macro looks something like this:
def fetch(*args):
model = getModel()
sheet = model.Sheets['sheetname']
row = 24
while len((cell := sheet[f"A{row}"]).String) > 0:
name = cell.String
if len(name) < 1:
row += 1
continue
code = MAP[name]
api_url = f"{BASE_URL}/{code}"
response = requests.get(api_url).json()
resp = response['data'][0]['resp'].strip()
cell2 = sheet[f"C{row}"]
if cell2.String in resp:
row += 1
continue
try:
cell2.setValue(float(resp))
except ValueError:
break
row += 1