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
var dateRange = "THIS_MONTH"; | |
function main() { | |
MccApp.accounts().withCondition("Cost > 1.00").forDateRange(dateRange).withLimit(50).executeInParallel('runOnEachAccount'); | |
} | |
function runOnEachAccount() { | |
var stats = AdWordsApp.currentAccount().getStatsFor(dateRange); | |
var impressions = stats.getImpressions(); | |
var clicks = stats.getClicks(); | |
var cost = stats.getCost(); |
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
var SPREADSHEET_URL = "YOUR URL HERE"; | |
function main() { | |
//These names are important. change them with caution | |
var tabs = ['ABC123', 'ABC123 LM']; | |
for(var i in tabs) { | |
var results = runQuery(tabs[i]); | |
writeToSpreadsheet(tabs[i],results); | |
} | |
} |
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 onOpen() {// Inserts a custom menu in the spreadsheet, lets you do neat stuff. | |
var ss = SpreadsheetApp.getActiveSpreadsheet(), | |
options = [ | |
{name:"Format The Current Sheet", functionName:"formatSheet"} | |
]; | |
ss.addMenu("Auto Formatter", options); | |
} | |
function formatSheet() {//Formats a single spreadsheet | |
var sheet = SpreadsheetApp.getActiveSheet(); |
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
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
var dateRange = "THIS_MONTH"; | |
function main() { | |
MccApp.accounts().withCondition("Cost > 1.00").forDateRange(dateRange).withLimit(50).executeInParallel('runOnEachAccount'); | |
} | |
function runOnEachAccount() { | |
var stats = AdWordsApp.currentAccount().getStatsFor(dateRange); | |
var impressions = stats.getImpressions(); | |
var clicks = stats.getClicks(); | |
var cost = stats.getCost(); |
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 removeExtraColumns() {// Formats all spreadsheets | |
var ss = SpreadsheetApp.getActive(); | |
for(var n in ss.getSheets()){// loop over all tabs in the spreadsheet | |
var sheet = ss.getSheets()[n];// look at every sheet in spreadsheet | |
var name = sheet.getName();//get name | |
var maxColumns = sheet.getMaxColumns(); | |
var lastColumn = sheet.getLastColumn(); | |
var subtract = maxColumns - lastColumn; | |
var lastNew = lastColumn + 1; | |
if(name != "*test"&& subtract > 0){ |
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
function onEdit(e) { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var name = sheet.getName(); | |
var cell = sheet.getActiveCell(); | |
var value = cell.getValue(); | |
if (typeof value == 'string') { | |
var spanish = LanguageApp.translate(value, 'en', 'es'); | |
cell.setValue(spanish); | |
} | |
} |
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
var SPREADSHEET_URL = "url"; | |
function main() { | |
var name = ("Google Adwords/Recieved Payment"); | |
var label = GmailApp.getUserLabelByName(name); | |
var unreadCount = label.getUnreadCount(); | |
var threads = label.getThreads(0,10); | |
for (var n = 0; n < threads.length; n++) { | |
var inbox = threads[n].isInInbox(); | |
var message = threads[n].getMessages(); | |
var lastDate = new Date(threads[n].getLastMessageDate()); |