How do I add/create/insert files to Google Drive through the API?

The documentation on insert operations already contains examples in a bunch of programming languages, here is how to do it using the HTTP based protocol of the Google Drive API. First, POST the new file metadata to the Drive endpoint. It has to be in the form of a File resource JSON object: POST /drive/v2/files … Read more

What are the Google Apps MIME Types in Google Docs and Google Drive?

Google Docs: application/vnd.google-apps.document application/vnd.google-apps.kix Google Presentations: application/vnd.google-apps.presentation Google Spreadsheets: application/vnd.google-apps.spreadsheet Google Drawing: application/vnd.google-apps.drawing See here for more information. Here is a long list of Google Docs and Google Drive MIME types (it is not exhaustive): application/vnd.google-apps.audio application/vnd.google-apps.document application/vnd.google-apps.drawing application/vnd.google-apps.file application/vnd.google-apps.folder application/vnd.google-apps.form application/vnd.google-apps.fusiontable application/vnd.google-apps.kix application/vnd.google-apps.photo application/vnd.google-apps.presentation application/vnd.google-apps.script application/vnd.google-apps.sites application/vnd.google-apps.spreadsheet application/vnd.google-apps.unknown application/vnd.google-apps.video

Script runtime execution time limit

One thing you could do (this of course depends on what you are trying to accomplish) is: Store the necessary information (i.e. like a loop counter) in a spreadsheet or another permanent store(i.e. ScriptProperties). Have your script terminate every five minutes or so. Set up a time driven trigger to run the script every five … Read more

Error: invalid_client no registered origin

In the new Google API Console, configure your OAuth2.0 authorized origins from Your Project > APIs & auth > Credentials You might need to add a new Client ID specifically for a web application (I did because the default was for AppEngine) Create Client ID > Web Application > Authorized Javascript origins If you are … Read more

Is it possible to send HTTP request from inside Google docs?

Using Google Apps Script, you can make HTTP requests to external APIs from inside Google Docs/Sheets/etc. using the UrlFetchApp class: var url=”https://gdata.youtube.com/feeds/api/videos?” + ‘q=skateboarding+dog’ + ‘&start-index=21’ + ‘&max-results=10’ + ‘&v=2’; var response = UrlFetchApp.fetch(url); Logger.log(response); Note that: This service requires the https://www.googleapis.com/auth/script.external_request scope. In most cases Apps Script automatically detects and includes the scopes a … Read more

How to download a Google Drive url via curl or wget

How about this method? When the file is such large size, Google returns a code for downloading the file. You can download the file using the code. When such large file is downloaded using curl, you can see the code as follows. <a id=”uc-download-link” class=”goog-inline-block jfk-button jfk-button-action” href=”/uc?export=download&amp;confirm=ABCD&amp;id=### file ID ###”>download</a> The query with confirm=ABCD … Read more