Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Developers
Integrate Google Drive with Google 
Apps Script 
Arun Nagarajan - Developer Advocate 
John McGowan - Software Engineer
Google Apps Script + Google Drive 
Focus on 2 integration scenarios 
● Drive SDK integration to allow for Create and Open ...
Demo - Quiz Manager
Demo - Quiz Manager 
Use student roster to generate and share files
Demo - Quiz Manager 
Requirements 
● Manage quiz lifecycle 
● Facilitate creation of multiple files 
● Integrated with Dri...
Demo time! 
github.com/entaq/GoogleAppsScript
Demo recap 
● Classroom example that lets the Teacher work within the Drive UI 
● Convert a Roster to a set of shared docu...
Key concepts 
Apps Script and Drive SDK
Google Apps Script
What is Google Apps Script
Apps Script 
Write code in a browser
Build Web Apps in Google Apps Script 
● Expose Web endpoints for application logic 
● Deploy to run as the end user or as ...
Google Drive SDK
Google Drive SDK 
Integrate into Drive UI 
● Meta-data defined via Developer Console 
● Build web app to receive context, ...
Drive SDK App lifecycle
Deeper into the Drive SDK
Enable Drive SDK Service
Drive SDK Settings
Drive SDK Settings - The important ones
Drive SDK Actions 
Create Parameters 
{ JSON 
folderId: "0A2wiPUk9PVA", 
action: "create", 
userId: "117678606781684" 
} 
...
Install to Google Drive
Drive Apps can be Mobile friendly 
● Will pass in same parameters 
● Only "Open With" supported
Deeper into Apps Script 
The new Drive Service
The new Drive Service in Apps Script 
● Written to provide new features of Drive API 
● More powerful search functionality...
The new Drive Service in Apps Script 
What's new? 
● You can now change the owner of a file or folder 
● Ability to share ...
The new Drive Service in Apps Script 
JS 
Setting the default sharing options 
quizTemplate.setSharing(DriveApp.Access.ANY...
The new Drive Service in Apps Script 
The simplified code of iterators 
var parentFolders = quiz.getParents(); JS 
while (...
The new Drive Service in Apps Script 
Searching for files 
Get all files named "Document" DriveApp.searchFiles("title='Doc...
The new Drive Service in Apps Script 
Things to note 
● No longer expose email addresses 
● Drive Service is built on Driv...
Write apps for Drive from anywhere...
We'd love your feedback! 
Room 8
Learn More! 
http://developers.google.com/apps-script/reference/drive 
+Arun Nagarajan 
+John McGowan
Developers
Upcoming SlideShare
Loading in …5
×

Integrate Google Drive with Google Apps Script

1,463 views

Published on

Google I/O 2013 Talk - Video recording here - https://developers.google.com/events/io/sessions/325412094

Published in: Technology
  • Be the first to comment

Integrate Google Drive with Google Apps Script

  1. 1. Developers
  2. 2. Integrate Google Drive with Google Apps Script Arun Nagarajan - Developer Advocate John McGowan - Software Engineer
  3. 3. Google Apps Script + Google Drive Focus on 2 integration scenarios ● Drive SDK integration to allow for Create and Open with capabilities ● Access files in Drive with new Drive Service in Apps Script
  4. 4. Demo - Quiz Manager
  5. 5. Demo - Quiz Manager Use student roster to generate and share files
  6. 6. Demo - Quiz Manager Requirements ● Manage quiz lifecycle ● Facilitate creation of multiple files ● Integrated with Drive UI ● Built with simple to manage App Script code
  7. 7. Demo time! github.com/entaq/GoogleAppsScript
  8. 8. 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
  9. 9. Key concepts Apps Script and Drive SDK
  10. 10. Google Apps Script
  11. 11. What is Google Apps Script
  12. 12. Apps Script Write code in a browser
  13. 13. 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
  14. 14. Google Drive SDK
  15. 15. Google Drive SDK Integrate into Drive UI ● 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
  16. 16. Drive SDK App lifecycle
  17. 17. Deeper into the Drive SDK
  18. 18. Enable Drive SDK Service
  19. 19. Drive SDK Settings
  20. 20. Drive SDK Settings - The important ones
  21. 21. Drive SDK Actions Create Parameters { JSON folderId: "0A2wiPUk9PVA", action: "create", userId: "117678606781684" } { ids: [ "0B0JNj_IMMzUtYTRhNy02MTc1MDE4NjkwNzA" ], action: "open", userId: "117678606781684" } JSON Open With Parameters
  22. 22. Install to Google Drive
  23. 23. Drive Apps can be Mobile friendly ● Will pass in same parameters ● Only "Open With" supported
  24. 24. Deeper into Apps Script The new Drive Service
  25. 25. 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
  26. 26. The new Drive Service in Apps Script What's new? ● You can now change the owner of a file or folder ● Ability to share a file publicly or to a domain through the API
  27. 27. The new Drive Service in Apps Script JS Setting the default sharing options quizTemplate.setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW);
  28. 28. The new Drive Service in Apps Script The simplified code of iterators var parentFolders = quiz.getParents(); JS while (parentFolders.hasNext()) { var parent = parentFolders.next(); parent.removeFile(quiz); }
  29. 29. 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 "user@gmail.com" DriveApp.searchFiles("'user@gmail.com' in writers");
  30. 30. The new Drive Service in Apps Script Things to note ● No longer expose email addresses ● Drive Service is built on Drive API
  31. 31. Write apps for Drive from anywhere...
  32. 32. We'd love your feedback! Room 8
  33. 33. Learn More! http://developers.google.com/apps-script/reference/drive +Arun Nagarajan +John McGowan
  34. 34. Developers

×