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

How to merge the two cells of a table in a Google text Document without this weird result?

[edit to address updates in Google Docs] This currently not possible. You can know if a cell is merged by looking calling getColSpan and getRowSpan but there are no setter methods. Please star the following issue to be notified by updates regarding this. The merge function you found is not specific to table cells, it … Read more

How do I add formulas to Google Sheets using Google Apps Script?

This is done using the setFormula for a selected cell. Below is an example of how to do this. var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; var cell = sheet.getRange(“B5”); cell.setFormula(“=SUM(B3:B4)”); You can also use setFormulaR1C1 to create R1C1 notation formulas. Example below. var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; var cell = … 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

How can I generate a multipage text document from a single page template in google-apps-script?

Well Serge, haven’t you tried the appendParagraph and other appends of the DocumentBodySection? I’d do it like this: function mergeDocs() { var docIDs = [‘list-of’,’documents’,’ids’,’you should have somehow’]; var baseDoc = DocumentApp.openById(docIDs[0]); var body = baseDoc.getActiveSection(); for( var i = 1; i < docIDs.length; ++i ) { var otherBody = DocumentApp.openById(docIDs[i]).getActiveSection(); var totalElements = otherBody.getNumChildren(); … Read more

How to define global variable in Google Apps Script

You might be better off using the Properties Service as you can use these as a kind of persistent global variable. click ‘file > project properties > project properties’ to set a key value, or you can use PropertiesService.getScriptProperties().setProperty(‘mykey’, ‘myvalue’); The data can be retrieved with var myvalue = PropertiesService.getScriptProperties().getProperty(‘mykey’);