2

The row in my spreadsheet has format

<value>, <formula>, <value>, <formula>, ...

I need to update this row. Indeed, I can't use range.setFormulas, because it has values and I can't use range.setValues, because it has formulas. The only way I found - to set by one value, but this is very expensive if I have a lot of cols in my sheet.

Is there any way to set both formulas and values in one network request?

PS. To set value via setFormula('"' + str + '"') is not very good idea

1
  • Why is setFormula('"' + str + '"') not a very good idea? Do you want to edit formulas with your script? If not why not just put the values all next to each other and the formulas on the end?
    – CodeCamper
    Dec 15, 2019 at 1:11

1 Answer 1

1

I can't use range.setFormulas, because it has values and I can't use range.setValues, because it has formulas

Wrong, just use setValues and if it is a formula add an equal sign to the beginning...

https://developers.google.com/apps-script/reference/spreadsheet/range#setvaluevalue

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.