Creating a reset button on Google Sheets

Creating a reset button on Google Sheets

Chris Lacy

5 лет назад

15,911 Просмотров

Link to Alice Keeler's Template Tab Script: https://alicekeeler.com/2015/01/02/google-sheets-copy-a-template-for-each-student/

Reset Button Script (copy everything below this line):
// This section adds the top menu
function onOpen() {
SpreadsheetApp.getUi().createMenu('Reset')
.addItem("Formulas Only", "ResetFormulas")
.addItem("Entire Page", "ResetPage")
.addToUi()
}

// This section makes a button to reset the whole page copies the entire page
function ResetPage() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('template'); // Enter tab name of what you’re copying from
sheet.getRange('A1:AZ192').copyTo(ss.getRange('A1:AZ192')) //enter entire tab range

}
// This section copies only the cells you specify
function ResetFormulas() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('template'); // Enter tab name here of what you’re copying from
//Header
sheet.getRange('A2:AK2').copyTo(ss.getRange('A2:AK2')) //first range you’re copying
sheet.getRange('Q3:AK3').copyTo(ss.getRange('Q3:AK3')) //next range
sheet.getRange('A4:AK4').copyTo(ss.getRange('A4:AK4')) //etc
sheet.getRange('A6:AZ9').copyTo(ss.getRange('A6:AZ9')) //you get it

}
Ссылки и html тэги не поддерживаются


Комментарии: