This file contains 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
function sortSheets(){ | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
var sheetNameArray = []; | |
var sheets = ss.getSheets(); | |
for (var i = 0; i < sheets.length; i++) { | |
sheetNameArray.push(sheets[i].getName()); | |
} | |
sheetNameArray.sort(); | |
for( var j = 0; j < sheets.length; j++ ) { | |
ss.setActiveSheet(ss.getSheetByName(sheetNameArray[j])); |
This file contains 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
function github() { | |
username = "xxx" | |
repo = "xxx" | |
url = "https://api.github.com/repos/"+username+"/"+repo+"/issues" | |
payload = { | |
"title": "xxx", | |
"body": "xxx", | |
"assignee": "xxx" | |
} | |
sendToGithub(url, payload) |
This file contains 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
1. Identifying Cells by Type in Google Spreadsheets | |
=if(index(split(D1, "::"),1) = "mobileapp", "Mobile", "Website") | |
------- | |
2. Get the root domain url of a cell in Google Spreadsheets | |
For sites with one TLD or one TLD and one subdomain: ie: xx.com or xx.xx.com | |
=iferror(join(".", index(split(A2, "."),2),index(left(split(A2, "."),3),3)), join(".", index(split(A2, "."),1),index(left(split(A2, "."),3),2))) | |
This file contains 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
//If the current cell is more than the previous cell, set it as lime green | |
function onEdit(e) { | |
var ss = SpreadsheetApp.getActive(); | |
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); | |
var name = sheet.getName(); | |
var range = sheet.getRange("A:J"); | |
var values = range.getValues(); | |
var cell = sheet.getActiveCell(); | |
var value = cell.getValue(); |
This file contains 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
/***What should this script do? | |
1. Loop through all of the spreadsheets | |
2. If the row after the row that contains AssociatedCampaignName is blank, Write "Waiting For Spot" in the next row after the cell that contains AssociatedCampaignName, IE: A2 | |
3. Write "#" in B2:H2 | |
**/ | |
function waiting(){ | |
var ss = SpreadsheetApp.getActive(); | |
for(var n in ss.getSheets()){// loop over all tabs in the spreadsheet |
This file contains 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
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()); |
This file contains 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
function getDirection(city1, city2) { | |
var directions = Maps.newDirectionFinder() | |
.setOrigin(city1).setDestination(city2) | |
.setMode(Maps.DirectionFinder.Mode.DRIVING) | |
.getDirections(); | |
var d = directions.routes[0].legs[0].distance.text; | |
return parseInt(d.split(" ")[0].replace(",", ""));; |
This file contains 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
// This script is designed to run on a 1 hour trigger in Google Apps Script. It is also written to "WRITE_TRUNCATE" your table | |
// which means it deletes the table and updates it with the newest information. You can change the variables in campaignList | |
// if you want to adjust it for your needs. | |
function chimpyAPI30days() { | |
projectId = "xxx"; | |
datasetId = "xxx"; | |
tableId = 'xxx'; | |
yesterday = new Date(); | |
yesterday.setDate(yesterday.getDate() - 29); |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
//Replace xxx with your values as necessary. | |
function googleAnalyticsReporting() { | |
projectId = "xxx"; | |
datasetId = "xxx"; | |
tableId = 'xxx'; | |
data = []; | |
yesterday = new Date(); | |
yesterday.setDate(yesterday.getDate() - 1); | |
yesterday = Utilities.formatDate(yesterday, 'UTC', "yyyy-MM-dd"); |
NewerOlder