I have a Google Sheet with about 300 rows in it. A couple of the columns have formulas like this:
=IF(ISBLANK(E210),C10,
QUERY(importrange(SheetKey,"SheetName!A:B"),"select Col2 where Col1="&E10,0))
What the formulas do:
When an ID number is entered in one cell, the other cell retrieves information from another cell of the row where the ID number is found. You may preview a copy at https://drive.google.com/previewtemplate?id=14yB8lqTdFvszLs7eaJcWQXVPtQcqBUjp4dJqIY_Yfx4&mode=public — see the "Rabbits_List" tab.
While entering new rows, there seems to be quite a bit of lag, I am guessing because of those formulas.
Is there a way to tie those cells updates to a script, so it can be linked to a button and run on demand?
I am using Google Sheets with the Chrome browser.
Best Answer
Here is a script that adds two custom menu commands: "Freeze Formulas" and "Unfreeze Formulas". The logic is very simple:
freezeFormulas
replaces every formula in the spreadsheet with text value of the formula, preceded by triple backtick (randomly chosen string that doesn't normally appear in spreadsheets; you can use something else like exotic Unicode characters or private use Unicode codepoints).The formula
freezeFormulas
finds all cells where the value begins with triple backtick, and restores them to formulas.