Last active
May 13, 2023 05:31
-
-
Save btamayo/3374b32a3b10ae55ee15f00f39c91b0b to your computer and use it in GitHub Desktop.
Revisions
-
btamayo revised this gist
May 13, 2023 . 1 changed file with 12 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,31 +1,36 @@ function ResizeRow() { // Be careful about this. If you change this to `getActiveSpreadSheet()`, it will be super confusing: // see https://www.reddit.com/r/GoogleAppsScript/comments/10dbe41/comment/j4knea5 var sheet = SpreadsheetApp.getActiveSheet(); var selection = sheet.getSelection(); var activeRange = selection.getActiveRange(); var rowsInSelection = activeRange.getNumRows(); var cell = selection.getCurrentCell(); var row = cell.getRow(); var col = cell.getColumn(); // Leaving these as an example of how to log and for debugging Logger.log('[Selection] Row: ' + row); Logger.log('[Selection] Col: ' + col); Logger.log('[Selection] rowsInSelection: ' + rowsInSelection); for (let i = 0; i < rowsInSelection; i++) { row = row + i; Logger.log('[Loop] Row: ' + row); Logger.log('[Loop] Col: ' + col); range = sheet.getRange(row, col) cell = sheet.setCurrentCell(range) Logger.log('[Range] cell: ' + cell.getA1Notation()); height = cell.getHeight() sheet.setRowHeight(row, height + 100); cell.setVerticalAlignment("middle"); cell.setWrapStrategy(SpreadsheetApp.WrapStrategy.WRAP); } return }; -
btamayo revised this gist
May 13, 2023 . 1 changed file with 31 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1 +1,31 @@ function ResizeRow() { // Be careful about this. If you change this to `getActiveSpreadSheet()`, it will be super confusing: // see https://www.reddit.com/r/GoogleAppsScript/comments/10dbe41/comment/j4knea5 var spreadsheet = SpreadsheetApp.getActiveSheet(); var selection = spreadsheet.getSelection(); var activeRange = selection.getActiveRange(); var rowsInSelection = activeRange.getNumRows(); var cell = selection.getCurrentCell(); var row = cell.getRow(); var col = cell.getColumn(); // Leaving this as an example of how to log Logger.log('[Selection] Row: ' + row); Logger.log('[Selection] Col: ' + col); Logger.log('[Selection] rowsInSelection: ' + rowsInSelection); for (let i = 0; i < rowsInSelection; i++) { row = row + i; range = spreadsheet.getRange(row, col) cell = spreadsheet.setCurrentCell(range) height = cell.getHeight() spreadsheet.setRowHeight(row, height + 50); cell.setVerticalAlignment("middle"); cell.setWrapStrategy(SpreadsheetApp.WrapStrategy.WRAP); } return }; -
btamayo created this gist
May 13, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ sdfsdfdf