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); }

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

How to poll a Google Doc from an add-on

The polling is done from the html code in your add-on’s User Interface, calling across to server-side Apps Script functions using google.script.run. Using jQuery simplifies this, and we can even start with the answers from jQuery, simple polling example. function doPoll(){ $.post(‘ajax/test.html’, function(data) { alert(data); // process results here setTimeout(doPoll,5000); }); } The basic idea … Read more