Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9696

How to set all checkboxes to FALSE in a specific column without losing formulas

$
0
0

I'm looking to reset all TRUE checkboxes to FALSE using a script. However, this column also has formulas I want to keep in certain cells (they are NOT checkboxes).

Is it possible to alter so that only TRUE/FALSE values are reset to FALSE?I've searched around, but can't seem to find anyone that had this similar issue.

This option currently resets all checkboxes, but includes all cells & switches my formulas to the word "FALSE" & thus, not working.

Script:

function Checks2() {    var spreadsheet = SpreadsheetApp.getActive();  spreadsheet.getRangeList(['a1:a1000']).activate()  spreadsheet.getRange('a1:a1000').setValue(false);  spreadsheet.getRange('a1').activate();};

This script keeps the non-checkbox values I have, but for some reason replaces my FORMULAS within those cells with plain text. I want these formulas to stay in the cells. Any ideas?

function myFunction() {var sheet = SpreadsheetApp.getActive().getSheetByName('Test')var dataRange = sheet.getRange('a3:I');var values = dataRange.getValues();for (var i = 0; i < values.length; i++) {  for (var j = 0; j < values[i].length; j++) {    if (values[i][j] == true) {      values[i][j] = false; // Modified    }  }}dataRange.setValues(values); // Added}

Viewing all articles
Browse latest Browse all 9696

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>