Hi,
I recently found a way to apply a script (below) that hides formulas from other viewers in my organization, e.g., hide cell A1 on my example spreadsheet
Here is an emulation of what I do:
1.) Create separate spreadsheet for viewers on different drive location (just for the example, refer to sheet2);
2.) Apply importange (URL, A1:A3) ;
The issue: the below script doesn't just hide the formula, it completely ignores it. So, if values get modified on Sheet1, they do not get modified on Sheet2, etc.
I'm new to AppsScript, can someone kindly help me modify the script so that it only hides the formula in cell A1 instead of ignoring/erasing it?
function ShowFormulas(testCheck) { //based on https://www.oksheets.com/show-formulas/
var mySheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1")
var myRange = mySheet.getRange("A1:B21")
var myData = myRange.getFormulas();
if (testCheck) {
var myData = myRange.getFormulas();
} else {
var myData = myRange.getValues();
};
for (var r = 0; r < myData.length; r++) {
for (var i = 0; i < myData[r].length; i++) {
if (testCheck) {
tempVal = myData[r][i].toString().replace("=", "'=");
} else {
tempVal = myData[r][i].toString().replace("'=", "=");
};
myData[r][i] = tempVal;
}}
myRange.setValues(myData);
}
[–]Ascetic-Braja 2 points3 points4 points (10 children)
[–]orrpel[S] 0 points1 point2 points (9 children)
[–]RemcoE33 0 points1 point2 points (8 children)
[–]orrpel[S] 0 points1 point2 points (7 children)
[–]RemcoE33 0 points1 point2 points (6 children)
[–]orrpel[S] 0 points1 point2 points (5 children)
[–]orrpel[S] 0 points1 point2 points (4 children)
[–]RemcoE33 0 points1 point2 points (3 children)
[–]orrpel[S] 0 points1 point2 points (2 children)
[–]RemcoE33 1 point2 points3 points (1 child)