Skip to content

Instantly share code, notes, and snippets.

@chipoglesby
Last active June 3, 2021 22:02
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chipoglesby/73d2662fc83ffea60766 to your computer and use it in GitHub Desktop.
Save chipoglesby/73d2662fc83ffea60766 to your computer and use it in GitHub Desktop.
Google App Script - Is range blank? If so, write predefined values
/***What should this script do?
1. Loop through all of the spreadsheets
2. If the row after the row that contains AssociatedCampaignName is blank, Write "Waiting For Spot" in the next row after the cell that contains AssociatedCampaignName, IE: A2
3. Write "#" in B2:H2
**/
function waiting(){
var ss = SpreadsheetApp.getActive();
for(var n in ss.getSheets()){// loop over all tabs in the spreadsheet
var sheet = ss.getSheets()[n];
var range = sheet.getRange("A2:H2");
if(range.isBlank()){
sheet.getRange('A2').setValue('Waiting For Spot');
sheet.getRange('B2:H2').setValue('#') }
}
}
@domusaurea5
Copy link

Thank you for sharing. I am using this to create a placeholder within Google Sheets for data input (for quote creation) and it's very handy.

@chipoglesby
Copy link
Author

@domusaurea5, you are welcome. Glad it helped!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment