Created
December 21, 2017 15:30
-
-
Save ithinkihaveacat/714fb833a94165714ed561388800421d to your computer and use it in GitHub Desktop.
Google Sheets: Resize Cells
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 characters
// Resize rows and columns to fit the data we're inserting. This requires special | |
// permission for some reason. | |
function setSizes() { | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
var sheets = ss.getSheets(); | |
for (var i=0; i < sheets.length; i++) { | |
var sheet = sheets[i]; | |
var range = sheet.getDataRange(); | |
var numRows = range.getNumRows(); | |
for (var r=2; r <= numRows; r++) { | |
sheet.setRowHeight(r, 160); | |
}; | |
[400, 120, 90, 70, 70, 70, 70].forEach(function (v, i) { | |
sheet.setColumnWidth(i + 1, v); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment