When I'm trying this, in my google sheet, the cell is filled by: '=max(9,6)
as a string. How can I make my equation usable?
here I added a google sheet and colab link to try it yourself
code example to try in colab:
from google.colab import auth
auth.authenticate_user()
import gspread
from google.auth import default
creds, _ = default()
gc = gspread.authorize(creds)
# creats a google sheet in your drive
sh = gc.create('formula_test')
#Note: using this code, you must remove the file from your drive each time
#or use a different name
#creats a sheet
wsh=sh.add_worksheet("test",rows=10,cols=10)
#this must a list of lists representing rows and cols
wsh.update([["5/6/22","=1 1","=max(9,6)"]])
Colab link:
https://colab.research.google.com/drive/18GXmroZnHioCS5Hui9TOeQjcAYjHfhck?usp=sharing
google sheets:
a primitive solution for Date is to change the format to date and it will be fixed. not a nice way but at least can be used for the long column
but for formulas (equations), the only way is to delete the ' manually one by one, Replace doesn't work on it
CodePudding user response:
Set the raw option as False
to treat the input as a formula
wsh.update([["5/6/22","=1 1","=max(9,6)"]], raw=False)