1var lastColumn = sheet.getLastColumn();
2// Returns the position of the last column that has content.
1//getRange(row, column, optNumRows, optNumColumns);
2Sheet.getRange(1,1,1,12);
3
4//row --- int --- top row of the range
5//column --- int--- leftmost column of the range
6//optNumRows --- int --- number of rows in the range.
7//optNumColumns --- int --- number of columns in the range
1// This example assumes there is a sheet named "first"
2var ss = SpreadsheetApp.getActiveSpreadsheet();
3var first = ss.getSheetByName("first");
4Logger.log(first.getMaxColumns());
5// getMaxColumns() returns the current number of columns in the sheet,
6// regardless of content.