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 characters
function doGet(request) { | |
if (request.parameters.url != undefined && request.parameters.url != "") { | |
var imageBlob = UrlFetchApp.fetch(request.parameters.url).getBlob(); | |
var resource = { | |
title: imageBlob.getName(), | |
mimeType: imageBlob.getContentType() | |
}; | |
var options = { | |
ocr: true | |
}; |
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 characters
function onOpen() { | |
var menuEntries = [ {name: "Create Diary Doc from Sheet", functionName: "createDocFromSheet"}]; | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
ss.addMenu("Fitness Diaries", menuEntries); | |
} | |
function createDocFromSheet(){ | |
var templateid = "1O4afl8SZmMxMFpAiN16VZIddJDaFdeRBbFyBtJvepwM"; // get template file id | |
var FOLDER_NAME = "Fitness Diaries"; // folder name of where to put completed diaries | |
// get the data from an individual user |
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 characters
// Part of this code up to END OF (c) is: | |
/* | |
Copyright 2011 Martin Hawksey | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 |
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 characters
// EventManagerV3 glued together by mhawksey http://www.google.com/profiles/m.hawksey | |
// Related blog post http://mashe.hawksey.info/eventmanagerv3/ | |
// With some code (settings, importIntoCalendar, sendEmails) from | |
// Romain Vialard's http://www.google.com/profiles/romain.vialard | |
// Manage your events: Calendar Importer and Registration Form | |
// https://spreadsheets.google.com/ccc?key=tCHuQkkKh_r69bQGt4yJmNQ | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
var BOOKING_ACTION_COL = 10; |
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 characters
function sendEmail(e) { | |
var emailTo = e.namedValues['20. Email confirmation (and badge)'][0]; | |
if (emailTo != ""){ | |
var text = 'Thank you for taking time to complete the ALT Annual Survey 2014. You can help us get a better understanding of how learning technology is used across sectors by sharing this link to the survey with your community: http://go.alt.ac.uk/ALT-Survey-2014\n\nYou might also use this suggested text in a tweet:\n\n " Just completed the ALT Annual Survey 2014 exploring use of learning technology across sectors. Have your say http://go.alt.ac.uk/ALT-Survey-2014 #altc "'; | |
var textHtml = HtmlService.createHtmlOutputFromFile('mailText').getContent(); | |
MailApp.sendEmail(emailTo, | |
"Thank you for completing the ALT Annual Survey 2014", | |
text, | |
{replyTo:"[email protected]", htmlBody: textHtml}); | |
} |
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 characters
function getResults() { | |
var connector = {'username':'YOUR_SITE_USERNAME', | |
'password':'YOUR_SITE_PASSWORD', | |
'connectorDomain':'YOUR_CONNECTOR_DOMAIN', | |
'userGuid':'YOUR_USER_GUID', | |
'connectorGuid':'YOUR_CONNECTOR_GUID', | |
'apiKey':'YOUR_API_KEY'} | |
var creds = {}; | |
creds[connector.connectorDomain] = { |
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 characters
<html> | |
<head> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
<title>Google Sheets as a Database – Authenticated INSERT with Apps Script using Execution API - Working Example</title> | |
<script type="text/javascript"> | |
// Your Client ID can be retrieved from your project in the Google | |
// Developer Console, https://console.developers.google.com | |
var CLIENT_ID = '<INSERT_YOUR_CLIENT_ID>'; | |
var SCRIPT_ID = '<INSERT_YOUR_SCRIPT_ID>'; |
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 characters
/* | |
To use you need to create an application on Github at https://github.com/settings/developers | |
The callback in this needs to be set to https://script.google.com/macros/d/{SCRIPT ID}/usercallback | |
Where {SCRIPT ID} is the ID of the script that is using this library. You can find your script's ID in the Apps Script code editor by clicking on the menu item "File > Project properties". | |
In this example code I've stored the apllicaitons clientId and clientSecret in the Script Properties: | |
- git_clientId | |
- git_clientSecret |
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 characters
function myFunction() { | |
try { | |
var out = []; | |
if (GmailApp.getInboxUnreadCount() > 0 ){ | |
var threads = GmailApp.getInboxThreads(); | |
for (var i = 0; i < threads.length; i++) { | |
out.push([threads[i].getMessages()[0].getFrom(), threads[i].getFirstMessageSubject(), threads[i].getMessages()[0].getDate()]); | |
threads[i].moveToArchive(); | |
} | |
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 characters
// Port of Slides API demo by Wesley Chun to Google Apps Script | |
// Source: http://wescpy.blogspot.co.uk/2016/11/using-google-slides-api-with-python.html | |
function slides_template() { | |
/* | |
from apiclient import discovery | |
from httplib2 import Http | |
from oauth2client import file, client, tools | |
*/ | |