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

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

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

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

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

Easiest way to get file ID from URL on Google Apps Script

DriveApp is indeed missing a getFileByUrl (and also folder for that matter). You may want to open an enhancement request on Apps Script issue tracker. But what I do on my scripts (since these openByUrl functions are somewhat new), is to get the id using a regex. Like this. function getIdFromUrl(url) { return url.match(/[-\w]{25,}/); } … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)