Created
February 3, 2020 14:34
-
-
Save LockeBirdsey/746c0f99b3b75960c8bc9b6d86a0f576 to your computer and use it in GitHub Desktop.
Google Apps Sheet script for resizing a stupid calendar I made: https://docs.google.com/spreadsheets/d/1EqaaZnwspsCpvzI-U_pdzoqem2EeLbdqswN8zNdz6LA/edit?usp=sharing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onEdit(e) { | |
var sheet = SpreadsheetApp.getActive().getActiveSheet(); | |
//Get the final potential rows | |
var row = 10; | |
var varA = SpreadsheetApp.getActiveSheet().getRange(row, 4).getValue(); | |
var varB = SpreadsheetApp.getActiveSheet().getRange(row, 5).getValue(); | |
var varC = SpreadsheetApp.getActiveSheet().getRange(row, 6).getValue(); | |
var varD = SpreadsheetApp.getActiveSheet().getRange(row, 7).getValue(); | |
var varE = SpreadsheetApp.getActiveSheet().getRange(row, 8).getValue(); | |
//resizing rows | |
var startRow = 12; | |
var endRow = 13; | |
var numCols = 8; | |
var numRows = endRow - startRow + 1; //Needs to be inclusive [x,y] not [x,y) | |
var rowRanges = sheet.getRange(startRow, numCols, numRows) | |
if (varA == "" || varB == "" | |
|| varC == ""|| varD == "" | |
|| varE == "") { | |
//hide the rows since they have nothing in them | |
sheet.hideRow(rowRanges) | |
} else { | |
sheet.unhideRow(rowRanges) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment