问题
I have a fairly basic function that is supposed to set a cell value (in theory a DataFrame, but I've replaced that with 1 as part of my debugging).
@xl.func
def RT_GetChartData():
excel = xl.Book.caller()
excel.app.display_alerts = False #I do this because I keep getting OLE errors
excel.sheets("EventDates").range("TempEventOutput").value = 1
return "done"
When I call this function from Excel, it sometimes sets the cell to 1 (but not every time, as I've replaced that with 2, 3, etc and doesn't update), and the cell returns simply
"Automation error"
Any ideas on whats going on... ? I've confirmed that the object types are correct, ie Book, Sheet, Range, so I dont think it's that...
来源:https://stackoverflow.com/questions/65112975/xlwings-automation-error-for-simple-udf-function-setting-cell-value