Closed LuigiBrito closed 3 years ago
In GSheets API, there's already an implemented setformula for a range.
hmm, can you please provide a link to the docs of the same?
if you want to apply formulae, use the code below
# set a formula and extend it to more cells
cell = wks.cell('C1')
cell.value = '=A1+B1'
wks.apply_format('C1:C10', cell, 'userEnteredValue.formulaValue')
I did same thing and got an error:
When I use your example:
cell = wks.cell('F2')
cell.value = '=B2+1'
wks.apply_format('F3:F300', cell, 'userEnteredValue.formulaValue')
AttributeError: 'Worksheet' object has no attribute 'apply_format'
I also tried different
cell = wks.cell('F2')
cell.formula = '=B2+1'
wks.get_values("F3","F300",returnas="range").apply_format(cell)
but got another error:
AttributeError: 'str' object has no attribute 'get_json'
When adding formulas to a range, I have to loop through the range and do a cell.formula = "=FORMULA". In GSheets API, there's already an implemented setformula for a range.
Hoping that setFormula be added to pygsheets