Created
April 27, 2015 17:01
-
-
Save stoneacheck/68a8f6bfa4065a41f81b to your computer and use it in GitHub Desktop.
Revisions
-
stoneacheck created this gist
Apr 27, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ function shortenUrl() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; var longUrls = sheet.getRange("J3:J10").getValues(); var writeValues = [] var numRows = longUrls.getNumRows(); var numCols = longUrls.getNumColumns(); for (var i =1 ; i <= numRows; i++) { var row = [] for (var j = 1; j <= numCols; j++) { var url = UrlShortener.Url.insert({ longUrl: longUrls}); var shortUrl = url.id; row.push(shortUrl) } writeValues.push(row) } sheet.getRange("M3:M10").setValues(writeValues) }