Last active
October 18, 2023 16:42
-
-
Save tuyendq/c2dac35e0f5753d6a1b5077ee5ae4de7 to your computer and use it in GitHub Desktop.
Google Sheets commonly used functions
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
/** | |
* Delete columns and rows | |
*/ | |
function DeleteColumnsAndRows() { | |
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); | |
var sheet = spreadsheet.getSheetByName("SHEET-NAME-HERE"); | |
// sheet.getRange(1, 2, sheet.getMaxRows(), sheet.getMaxRows()).activate(); | |
// Delete column B to max | |
if (sheet.getMaxColumns() > 1) { | |
sheet.deleteColumns(2, sheet.getMaxColumns()-1); | |
} | |
// Delete row 2 to max | |
if (sheet.getMaxRows() > 1) { | |
sheet.deleteRows(2, sheet.getMaxRows()-1); | |
} | |
}; | |
// Get value from "Price" sheet, 'N2' cell | |
var cellValue = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Price").getRange('N2').getValue(); | |
// Logger.log(cellValue); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment