Integrate Google Drive with Google Apps Script
-
Upload
arun-nagarajan -
Category
Technology
-
view
159 -
download
1
description
Transcript of Integrate Google Drive with Google Apps Script
![Page 1: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/1.jpg)
Developers
![Page 2: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/2.jpg)
Integrate Google Drive with Google Apps Script
Arun Nagarajan - Developer AdvocateJohn McGowan - Software Engineer
![Page 3: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/3.jpg)
Google Apps Script + Google Drive
● Drive SDK integration to allow for Create and Open with capabilities
Focus on 2 integration scenarios
● Access files in Drive with new Drive Service in Apps Script
![Page 4: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/4.jpg)
Demo - Quiz Manager
![Page 5: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/5.jpg)
Demo - Quiz ManagerUse student roster to generate and share files
![Page 6: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/6.jpg)
Demo - Quiz ManagerRequirements
● Manage quiz lifecycle● Facilitate creation of multiple files● Integrated with Drive UI● Built with simple to manage App Script code
![Page 7: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/7.jpg)
Demo time!github.com/entaq/GoogleAppsScript
![Page 8: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/8.jpg)
Demo recap
● Classroom example that lets the Teacher work within the Drive UI
● Convert a Roster to a set of shared documents with one click
● Custom MIME type files for "command runners"
● Several improvement possibilities○ Monitor progress and alert before deadline○ Auto "close" assignments○ Create nice assignment dashboard
![Page 9: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/9.jpg)
Key conceptsApps Script and Drive SDK
![Page 10: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/10.jpg)
Google Apps Script
![Page 11: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/11.jpg)
What is Google Apps Script
![Page 12: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/12.jpg)
Apps ScriptWrite code in a browser
![Page 13: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/13.jpg)
Build Web Apps in Google Apps Script
● Expose Web endpoints for application logic
● Deploy to run as the end user or as the developer
● Possible to restrict access to a domain
● Implement doGet method to get access to inputs
![Page 14: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/14.jpg)
Google Drive SDK
![Page 15: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/15.jpg)
Google Drive SDK
● Meta-data defined via Developer Console
● Build web app to receive context, perform application logic
● Install via OAuth 2 drive.install scope or Chrome Web Store
Integrate into Drive UI
![Page 16: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/16.jpg)
Drive SDK App lifecycle
![Page 17: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/17.jpg)
Deeper into the Drive SDK
![Page 18: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/18.jpg)
Enable Drive SDK Service
![Page 19: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/19.jpg)
Drive SDK Settings
![Page 20: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/20.jpg)
Drive SDK Settings - The important ones
![Page 21: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/21.jpg)
Drive SDK Actions
Create Parameters
JSON{
folderId: "0A2wiPUk9PVA",
action: "create",
userId: "117678606781684"
}
{
ids: [
"0B0JNj_IMMzUtYTRhNy02MTc1MDE4NjkwNzA"
],
action: "open",
userId: "117678606781684"
}
JSON
Open With Parameters
![Page 22: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/22.jpg)
Install to Google Drive
![Page 23: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/23.jpg)
Drive Apps can be Mobile friendly
● Will pass in same parameters
● Only "Open With" supported
![Page 24: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/24.jpg)
Deeper into Apps ScriptThe new Drive Service
![Page 25: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/25.jpg)
The new Drive Service in Apps Script
● Written to provide new features of Drive API
● More powerful search functionality
● Simpler code for retrieving files and folders
![Page 26: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/26.jpg)
The new Drive Service in Apps Script
● You can now change the owner of a file or folder
● Ability to share a file publicly or to a domain through the API
What's new?
![Page 27: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/27.jpg)
The new Drive Service in Apps Script
JSquizTemplate.setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW);
Setting the default sharing options
![Page 28: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/28.jpg)
The new Drive Service in Apps Script
The simplified code of iterators
JSvar parentFolders = quiz.getParents();
while (parentFolders.hasNext()) {
var parent = parentFolders.next();
parent.removeFile(quiz);
}
![Page 29: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/29.jpg)
The new Drive Service in Apps Script
Searching for files
Get all files named "Document" DriveApp.searchFiles("title='Document'");
Get all files modified after Christmas DriveApp.searchFiles("modifiedDate >= '2012-12-26T00:00'");
Get files writable by "[email protected]" DriveApp.searchFiles("'[email protected]' in writers");
![Page 30: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/30.jpg)
The new Drive Service in Apps Script
● No longer expose email addresses
● Drive Service is built on Drive API
Things to note
![Page 31: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/31.jpg)
Write apps for Drive from anywhere...
![Page 32: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/32.jpg)
We'd love your feedback!
Room 8
![Page 33: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/33.jpg)
Learn More!http://developers.google.com/apps-script/reference/drive
+Arun Nagarajan+John McGowan
![Page 34: Integrate Google Drive with Google Apps Script](https://reader033.fdocuments.net/reader033/viewer/2022061203/547dc8075806b5c75e8b45c3/html5/thumbnails/34.jpg)
Developers