google sheets script add new row code example
Example 1: google script get sheet size
var lastColumn = sheet.getLastColumn();
// Returns the position of the last column that has content.
Example 2: google script get sheet size
// This example assumes there is a sheet named "first"
var ss = SpreadsheetApp.getActiveSpreadsheet();
var first = ss.getSheetByName("first");
Logger.log(first.getMaxColumns());
// getMaxColumns() returns the current number of columns in the sheet,
// regardless of content.