4
votes

Specifically, I need a script to help me clear values from multiple rows but without clearing the formulas on those rows.

I have tried .clearContent which seems to just clear the whole row altogether without any option to keep the formulas.

I know that there might be some add-on that could help on a single sheet but I need to apply the procedure on multiple sheets so I would like to use a script for it.

Thanks!

1
Actually, the data used is a log from an ImportHtml with formulas inserted inbetween to produce a result. And some of the data are not relevant anymore as I am going to list the highest values in another sheet. - Sid Me
As the data is going to change on a daily basis but I am probably only going to update it weekly, I don't want to lose the formulas as I would have to re-enter them on 20+ sheets. - Sid Me
More elegant solution from @Chris S here stackoverflow.com/questions/24783968/… - aNewb

1 Answers

9
votes

Use range.getFormulas() to store your formulas, then call range.clearContent(), finally paste the formulas back with range.setFormulas().