Skip to content

Instantly share code, notes, and snippets.

@stoneacheck
Created April 27, 2015 17:08
Show Gist options
  • Save stoneacheck/10abd1d9aa9a8b8e0432 to your computer and use it in GitHub Desktop.
Save stoneacheck/10abd1d9aa9a8b8e0432 to your computer and use it in GitHub Desktop.

Revisions

  1. stoneacheck created this gist Apr 27, 2015.
    21 changes: 21 additions & 0 deletions Stoney's dumb GAS project 2
    Original 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 = []


    for (var i =1 ; i <= numRows; i++) {
    var row = []
    var numRows = longUrls.getNumRows();
    var numCols = longUrls.getNumColumns();
    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)
    }