直接报错
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2146827284), None)
还有# sheet.range("G3").api.Validation.Add(Type=3, AlertStyle=2, Formula1="=A,B"),加了=号还是一样出错
sheet.range("G3").api.Validation.Add(Type=3, AlertStyle=1, Operator=3, Formula1=r"=, /, t") # 错误
sheet.range("G3").api.Validation.Add(Type=3, AlertStyle=1,Operator=3, Formula1='''+,-,*,/''') # Right
sheet.range("G3").api.Validation.Add(3, 1,3, '''+,-,*,/''') # Right
问答区域有两个错误:
这个A,B 是啥, 这个写法就算是excel 里会出错呀
你想要实现什么公式
增加公式的写法参考这个
sheet.range("D3").formula ="=A3/B3"