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
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'); }); }
I was expecting something more complex, but your simple script was the answer to my problem. Nice Job!
Glad it helped!
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
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');
});
}
@@redtailfanschool Thanks a lot. You've helped, I need to learn how to use Apps Script.