Apps Script to reset all the dropdown menus to "All" on the dashboard

Поділитися
Вставка
  • Опубліковано 14 жов 2024

КОМЕНТАРІ • 6

  • @fyrman9092
    @fyrman9092 9 місяців тому +1

    I was expecting something more complex, but your simple script was the answer to my problem. Nice Job!

  • @andersonmenezes6374
    @andersonmenezes6374 2 місяці тому

    I have a question. How can I do it with other pages for example 'sheet6' 'sheet7' 'shee8' in the same cell and column. col1 ('A2') for all the pages? by the way your videos are awesome. congratulations

    • @redtailfanschool
      @redtailfanschool  2 місяці тому +1

      This will loop through all sheets and perform the function on all sheets if they are the same. If there are some sheets that are not set up this way, one would have to adjust the logic to not do the function on those sheets.
      function resetValues(){
      const ss = SpreadsheetApp.getActiveSpreadsheet();
      const sheets = ss.getSheets();
      sheets.forEach(sheet => {
      sheet.getRange('A2').setValue('All Ages');
      sheet.getRange('B2').setValue('All Ages');
      sheet.getRange('C2').setValue('All Genders');
      sheet.getRange('D2').setValue('All Pain Type');
      sheet.getRange('E2').setValue('All Resting BP');
      sheet.getRange('F2').setValue('All Cholesterol');
      sheet.getRange('G2').setValue('All Resting ECG');
      sheet.getRange('H2').setValue('All Max HR');
      sheet.getRange('I2').setValue('All Exercise Angina');
      sheet.getRange('J2').setValue('All Oldpeak');
      sheet.getRange('K2').setValue('All ST_Slope');
      });
      }

    • @andersonmenezes6374
      @andersonmenezes6374 2 місяці тому

      @@redtailfanschool Thanks a lot. You've helped, I need to learn how to use Apps Script.