google-apps-script

Google Apps Script targeting header on doc with different first page headers

橙三吉。 提交于 2020-07-06 11:31:49
问题 I have a simple little apps script that refreshes our dynamic logo on request. The problem is I can't target the header if the designer checks "Different first page header/footer" checkbox. Is there away to target the different header if it's checked? Here is the code I'm currently using: function onOpen() { DocumentApp.getUi().createMenu('Branding') .addItem('Update Branding', 'updateLogo') .addToUi(); } function updateLogo() { var doc = DocumentApp.getActiveDocument(); var header = doc

We're sorry, a server error occurred while reading from storage. Error code PERMISSION_DENIED

天大地大妈咪最大 提交于 2020-07-05 07:46:11
问题 I wrote a google scripts editor addon, and published it to the google marketplace with private visibility (it is only visible to the users in my organization). I tested the addon with all types of permissions (installed for current user, enabled in current document, installed and enabled) in the script editor, and everything works as intended. However, after publishing the addon to the marketplace and installing it in a test spreadsheet, I keep getting this error: We're sorry, a server error

Update/Replace inline image on Google Document

☆樱花仙子☆ 提交于 2020-07-05 03:45:12
问题 I'm trying to set a feature to update images on a Google Document, the same way Lucidchart Add-on does on its "Updated inserted diagram" feature. For this, I'm current doing the following: Creating a Named Range and storing its id on document properties, together with the data to generate the image, for later retrieve. On update, call body.getNamedRangeById() and replace the element with the new generated image. This works, but I have the following problems that does not happen with

Very slow “Logs” with Google Apps Script V8 vs Rhino?

北城余情 提交于 2020-07-04 13:00:06
问题 With Rhino, Logs dialog ("command + Enter" or Logs from View menu) shows logs instantly. However, with test projects using V8 engine it takes 10-20 seconds to load even the simplest logs, with a message "Waiting for logs, please wait..." Both, "Logger.log" or "console.log" are slow to load logs. Is anyone else experiencing the same type of slowness? Is this expected with the new engine? Thank you in advance! Here's a basic function I used for testing: function logTest() { Logger.log("log test

How to use scriptlets in HTMLOutput in Google Apps Script

社会主义新天地 提交于 2020-07-04 09:53:28
问题 I'm loading a modal dialog with: var html = HtmlService.createHtmlOutputFromFile('File') .setSandboxMode(HtmlService.SandboxMode.IFRAME) .setWidth(1000) .setHeight(700); SpreadsheetApp.getUi() .showModalDialog(html, 'My Page'); Now, in File.HTML, I want to load another HTML file with CSS settings, how do I do that? I've tried including it as in HtmlTemplate using scriptlets but it doesn't work: <?!= include('File'); ?> EDIT: I have defined the include function in code.gs: function include

How to use scriptlets in HTMLOutput in Google Apps Script

谁都会走 提交于 2020-07-04 09:53:13
问题 I'm loading a modal dialog with: var html = HtmlService.createHtmlOutputFromFile('File') .setSandboxMode(HtmlService.SandboxMode.IFRAME) .setWidth(1000) .setHeight(700); SpreadsheetApp.getUi() .showModalDialog(html, 'My Page'); Now, in File.HTML, I want to load another HTML file with CSS settings, how do I do that? I've tried including it as in HtmlTemplate using scriptlets but it doesn't work: <?!= include('File'); ?> EDIT: I have defined the include function in code.gs: function include

onFormSubmit Trigger occurs twice randomly about every few weeks

余生颓废 提交于 2020-07-03 13:33:12
问题 Firstly, I want to say that this issue is different from all previous Form Submit Trigger errors with Google Apps script. This one triggers twice, while still having access to all form submit info of the previous form submission and triggers the program again. Furthermore, the additional form submit trigger glitch does not add a row to the spreadsheet form responses, this is because the user isn't submitting the form twice, it's on Google for triggering it. This has happened randomly about 3

How to count the number of cells which contain specific text using Google Sheet Scripts?

谁说我不能喝 提交于 2020-07-03 13:00:40
问题 How to count the number of cells which contain specific text using Google sheet scripts? Currently I'am using the following script to count the number of cells which contain specific text, for example cells which contain: 'Complete' or 'Not Complete'. function COUNT_TEXT_ACROSS_SHEETS(sheetNames, range, text) { sheetNames = sheetNames.split(','); var count = 0; sheetNames.forEach(function(sheetName) { var sheet = SpreadsheetApp.getActive().getSheetByName(sheetName); var values = sheet

How to count the number of cells which contain specific text using Google Sheet Scripts?

偶尔善良 提交于 2020-07-03 13:00:08
问题 How to count the number of cells which contain specific text using Google sheet scripts? Currently I'am using the following script to count the number of cells which contain specific text, for example cells which contain: 'Complete' or 'Not Complete'. function COUNT_TEXT_ACROSS_SHEETS(sheetNames, range, text) { sheetNames = sheetNames.split(','); var count = 0; sheetNames.forEach(function(sheetName) { var sheet = SpreadsheetApp.getActive().getSheetByName(sheetName); var values = sheet

Union multiple ranges in google sheets with programmatic lookup

北战南征 提交于 2020-07-03 09:35:04
问题 I have a google sheet with a dynamically changing number of worksheets within it. I'd like to be able to automatically union all worksheets that included in a named range that has the worksheet names. I have a manual formula that is working and will union all data into a single worksheet. I'd like to make this computed from the named range. UNION FORMULA ={QUERY('Sheet1'!A2:L, "select * where A != ''");QUERY('Sheet2'!A2:L, "select * where A != ''")} I also have a named range in another sheet