Last active
November 29, 2020 19:27
Revisions
-
chipoglesby revised this gist
Sep 12, 2016 . 1 changed file with 1 addition and 1 deletion.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 @@ -6,7 +6,7 @@ function uploadData() { var maxRows = ss.getLastRow(); var maxColumns = ss.getLastColumn(); var data = []; for (var i = 1; i <= maxRows;i++) { data.push(ss.getRange([i], 1,1, maxColumns).getValues()); } var newData = data.join("\n"); -
chipoglesby revised this gist
Sep 10, 2015 . 1 changed file with 1 addition and 1 deletion.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 @@ -16,6 +16,6 @@ function uploadData() { SpreadsheetApp.getUi().alert("Uploading: OK"); } catch(err) { SpreadsheetApp.getUi().alert("Cannot upload: Failed"); } } -
chipoglesby created this gist
Sep 10, 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 uploadData() { var accountId = "xxxxxxxx"; var webPropertyId = "UA-xxxxxxxx-x"; var customDataSourceId = "xxxxxxxx"; var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); var maxRows = ss.getLastRow(); var maxColumns = ss.getLastColumn(); var data = []; for (var i = 1; i < maxRows;i++) { data.push(ss.getRange([i], 1,1, maxColumns).getValues()); } var newData = data.join("\n"); var blobData = Utilities.newBlob(newData, "application/octet-stream", "GA import data"); try { var upload = Analytics.Management.Uploads.uploadData(accountId, webPropertyId, customDataSourceId, blobData); SpreadsheetApp.getUi().alert("Uploading: OK"); } catch(err) { SpreadsheetApp.getUi().alert("Cannot uploading: Failed"); } }