google script get sheet size
var lastColumn = sheet.getLastColumn(); // Returns the position of the last column that has content.
Here is what the above code is Doing:
1. Get the active spreadsheet.
2. Get the active sheet.
3. Get the last row that has content.
4. Get the last column that has content.