Alerts when navigating away from a web page

By the browser. It’s the beforeunload event handler that returns the customized text of the dialog, which is only the middle of the three paragraphs – the other two paragraphs as well as the text of the buttons cannot be customized or otherwise changed. window.onbeforeunload = function(){ return ‘Testing…’ } // OR var unloadListener = … Read more

How do I communicate a page(modal dialog) with its sibling (sidebar)?

Perhaps it’s not really its parent and that’s the reason for it not working. Right – there isn’t actually a DOM parent / child relationship in play here. Both the sidebar and the modal dialog were launched from server-side scripts, and are independent. They can both communicate with the server, though, so you can use … Read more

Can I color certain words in Google Document using Google Apps Script?

With the introduction of document-bound scripts, it’s now possible to make a text highlighting function that’s invoked from a custom menu. Surely THIS is the best answer now! 8^) This script was modified from the one in this answer, and may be called from the UI (with no parameters) or a script. /** * Find … 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

Get Google Document as HTML

You can try this code : function getGoogleDocumentAsHTML(){ var id = DocumentApp.getActiveDocument().getId() ; var forDriveScope = DriveApp.getStorageUsed(); //needed to get Drive Scope requested var url = “https://docs.google.com/feeds/download/documents/export/Export?id=”+id+”&exportFormat=html”; var param = { method : “get”, headers : {“Authorization”: “Bearer ” + ScriptApp.getOAuthToken()}, muteHttpExceptions:true, }; var html = UrlFetchApp.fetch(url,param).getContentText(); Logger.log(html); }