google-apps-script

Build range with string

狂风中的少年 提交于 2021-02-17 06:25:08
问题 I have this statement: var destinationRange = destinationSheet.getRange("D26:E39"); and want to replace it with var destinationRange = destinationSheet.getRange(daGrowaRange); The reason I want to use daGrowaRange is not just cause da name, but that the range is not always the same. D is a fixed constant value and never changes E is a fixed constant value and never changes BUT 26 is dynamic and changes and 39 is an offset based on the 26 (in this case 13 so 39 = 26+13, but the 13 is a

Statement cancelled due to timeout or client request

血红的双手。 提交于 2021-02-17 06:21:36
问题 I am trying to add data to my Google Cloud SQL database using Google App Script. My code was working fine last night when I finished but when I ran it this morning it is now giving me the error "statement cancelled due to timeout or client request", the error I am getting in the cloud console is "Got an error reading communication packets". Last night it was processing about 1,600 lines of data. I have played around with it and narrowed it down that the error will occur when there is more the

Statement cancelled due to timeout or client request

佐手、 提交于 2021-02-17 06:21:30
问题 I am trying to add data to my Google Cloud SQL database using Google App Script. My code was working fine last night when I finished but when I ran it this morning it is now giving me the error "statement cancelled due to timeout or client request", the error I am getting in the cloud console is "Got an error reading communication packets". Last night it was processing about 1,600 lines of data. I have played around with it and narrowed it down that the error will occur when there is more the

Summing of Two Arrays in App Scripts (Google Sheets)

自作多情 提交于 2021-02-17 05:24:05
问题 I'm working with a Spreadsheet where I need to get the values of 2 ranges (in arrays) and return the sum of those. I found code and tried to plug it in, but it seems to be just concatenating the 2 arrays instead of actually summing them up. The data I'm pulling is from my spreadsheet. The arrays are 5 Columns and 23 rows. The arrays are of the same size. Here is my function that grabs the values of each arrays. It will then run it through the Arrays_sum function I found and return and update

Gmail AppScript mailMessage.getFrom() to return email not name

喜夏-厌秋 提交于 2021-02-17 03:59:08
问题 Similar to: Getting only email address to display when using message.getFrom() in JavaMail but could not apply the solution. Trying to use mailMessage.getFrom() on Google AppScript with Gmail. Default script: function loadAddOn(event) { var accessToken = event.messageMetadata.accessToken; var messageId = event.messageMetadata.messageId; GmailApp.setCurrentMessageAccessToken(accessToken); var mailMessage = GmailApp.getMessageById(messageId); var from = mailMessage.getFrom(); var openDocButton

Gmail AppScript mailMessage.getFrom() to return email not name

假如想象 提交于 2021-02-17 03:58:49
问题 Similar to: Getting only email address to display when using message.getFrom() in JavaMail but could not apply the solution. Trying to use mailMessage.getFrom() on Google AppScript with Gmail. Default script: function loadAddOn(event) { var accessToken = event.messageMetadata.accessToken; var messageId = event.messageMetadata.messageId; GmailApp.setCurrentMessageAccessToken(accessToken); var mailMessage = GmailApp.getMessageById(messageId); var from = mailMessage.getFrom(); var openDocButton

Need a way to extract specific data from Firebase RealtimeDB to Google Sheets

扶醉桌前 提交于 2021-02-17 03:31:32
问题 I'm trying to transfer Firebase RealtimeDB data into Google Sheets using AppScript. I need a way to extract ID, Department, and Surname strings from the DB while it is received as such from the Logs below. I use .childByAutoID() which has the following effect on the DB. My database: Desired result in spreadsheet: function writeSheets() { var firebaseUrl = "<my-database>.firebaseio.com/Attendees"; var base = FirebaseApp.getDatabaseByUrl(firebaseUrl); var data = base.getData(); console.log(JSON

What is the best way to create Container-bound Scripts that can be cloned?

时间秒杀一切 提交于 2021-02-17 03:19:40
问题 According to Google Apps Script, container-bound scripts https://developers.google.com/apps-script/guides/bound is limited to that file. I wrote a script that reads some values of GSheet and submits it to the server. But I also want this spreadsheet to be cloned for different usages. But each time I clone this spreadsheet, it creates a new container-bound script and it asks for permissions again. Is there a way to clone the spreadsheet and have it run the script without asking for permissions

Html tag beginning with question mark?

被刻印的时光 ゝ 提交于 2021-02-16 20:35:16
问题 I'm learning google apps script, and in this tutorial, I saw some weird looking syntax: <? /* JS code */ ?> and <?= /* JS code */ ?> <!DOCTYPE html> <html> <head> <base target="_top"> <title>Message Display Test</title> <link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css"> </head> <body style="padding:3em;"> <h1>Messages</h1> <ul> <? for(var m=0;m<messages.length;m++){ ?> <li><?= messages[m].getSubject() ?></li> <p><?= messages[m].getPlainBody() ?></p> <? } ?> <

Google Apps Script to open password-protected Excel?

丶灬走出姿态 提交于 2021-02-16 18:21:08
问题 Is there a way for Google Apps Script to open a password-protected Excel file if the password is supplied when getting the file? I don't see any DriveApp method that accepts a "password" parameter. If not, then can this be implemented using the Google Drive API? Is there a "password" key I can use in an "options" object of a gapi.client.drive.files.get() or a similar method? 回答1: No, that is not possible with Apps Script or Google APIs at this time. You can always file a feature request in