Reset Checkboxes and Delete Notes on Defined sheets

后端 未结 1 1985
南旧
南旧 2021-01-21 19:22

I need to reset checkboxes to FALSE (Unchecked) and also delete all notes from defined sheets.

Also need a script that deletes all notes from a Google sheet (all sheets)

相关标签:
1条回答
  • 2021-01-21 19:56

    How about this modification?

    Modification points:

    • In your script, the variable of i is used at both for (var i = 0; i < tabs.length; i++) { and for (var i = 0; i < values.length; i++) {.
      • By this, the value of i of for (var i = 0; i < tabs.length; i++) { is not increased every 1.
      • I think that this is one of your issues of It does not loop through the pages and delete the notes..
      • For example, please modify to for (var k = 0; k < tabs.length; k++) {var sheet=ss.getSheetByName(tabs[k]);.
    • Equality comparison == is used for comparing the boolean.
      • I think that this is another issue of it sometimes replaces a "1" with a FALSE.
      • Please modify this to the strict equality comparison ===.

    Modified script:

    Please modify as follows.

    From:
    for (var i = 0; i < tabs.length; i++) {
        var sheet = ss.getSheetByName(tabs[i]);
    
    To:
    for (var k = 0; k < tabs.length; k++) {
        var sheet = ss.getSheetByName(tabs[k]);
    

    And

    From:
    if (values[i][j] == true) {
    
    To:
    if (values[i][j] === true) {
    

    Reference:

    • Equality comparisons and sameness

    If I misunderstood your question, please tell me. I would like to modify it.

    0 讨论(0)
提交回复
热议问题