Download a spreadsheet from Google Drive / Workspace using Python

The https://github.com/burnash/gspread library is a newer, simpler way to interact with Google Spreadsheets, rather than the old answers to this that suggest the gdata library which is not only too low-level, but is also overly-complicated. You will also need to create and download (in JSON format) a Service Account key: https://console.developers.google.com/apis/credentials/serviceaccountkey Here’s an example of … Read more

Creating anchored comments programmatically in Google Docs

The Anchoring Comments feature from the Google Drive API is intended for non-Google Docs editors files, not for Google Documents. See https://youtu.be/ZBU52nacbLw?t=5m26s (credit to Bryan P who shared this URL through a comment) Unfortunatelly at this time the Document Service from Google Apps Script doesn’t include a Class Comment to handle comments and discussions. At … Read more

Insert date time in google document

This works well In Google Docs : Tools -> Open Script Editor and save this script function onOpen() { var ui = DocumentApp.getUi(); // Or FormApp or SpreadsheetApp. ui.createMenu(‘Custom Menu’) .addItem(‘Insert Date’, ‘insertDate’) .addToUi(); } function insertDate() { var cursor = DocumentApp.getActiveDocument().getCursor(); if (cursor) { // Attempt to insert text at the cursor position. If … Read more

Google Docs Viewer occasionally failing to load content in iframe

This is not fixing your problem per se, but since I had the same problem and I eventually managed to find an acceptable solution, I thought I’d share it. var $docViewer = $(`<iframe src=”https://stackoverflow.com/questions/35298724/${newValue}” height=”100%” width=”100%”></iframe>`); //If using modern browser, use and embed object if (window.chrome || typeof (window.mozInnerScreenX) != “undefined”) $docViewer = $(`<object width=”100%” … 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

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

Convert a Markdown text file into a Google Document using Appscript?

One suggestion: use Pandoc to convert Markdown to docx, then import to Google Docs using the Google Drive API. You can also accomplish this using the Google Drive web interface: Convert markdown to ODT (or some other intermediate) using pandoc: pandoc MyFile.md -f markdown -t odt -s -o MyFile.odt Move the ODT file into your … Read more