google-apps-script

Google Script - get data from Gmail into Sheet

陌路散爱 提交于 2021-01-08 04:53:11
问题 I have been looking around here on SO and on Google, but I cannot find anything that is working. So when I am running my code below, I am getting the result on the image. I want to extract data from the newest/most recent thread in mails that have a specific label. However, in my Gmail , I only have the 3 mails under "Action"-label that I have highlighted in bold. The other mails have been deleted, hence, they are in trash, but do still have the "Action" label. I want to only show the mails

Move 2d Array to Spreadsheet

回眸只為那壹抹淺笑 提交于 2021-01-07 10:39:22
问题 How do I take a 2d Array in google script and push the whole thing to a range in a spreadsheet? Here is what I have: Assume that array is created and filled and has 6000+ rows and 4 columns. The following code gives me an incorrect range error. Incorrect range width was 0 but should be 4 (line 56, file "Code"): formatted.getRange(1,1,targetArray.length,targetArray[0].length).setValues(targetArray); The following code functions but times out because the data set is too large: for(var i=0; i

How to dynamically create installable triggers as other users in Google Apps Script?

送分小仙女□ 提交于 2021-01-07 07:11:39
问题 So I have a Google Form-bound script that creates an installable trigger every time the Form is submitted. Now, I shared both the Form and the script to the actual users. At some point I have noticed that new triggers are not being created because quota limit is already reached. As I reviewed the list of installed triggers, I noticed that all of them are installed as "Me". How do I do it so that the other users who actually submitted the form (and created the installable trigger in the

How to dynamically create installable triggers as other users in Google Apps Script?

社会主义新天地 提交于 2021-01-07 07:10:10
问题 So I have a Google Form-bound script that creates an installable trigger every time the Form is submitted. Now, I shared both the Form and the script to the actual users. At some point I have noticed that new triggers are not being created because quota limit is already reached. As I reviewed the list of installed triggers, I noticed that all of them are installed as "Me". How do I do it so that the other users who actually submitted the form (and created the installable trigger in the

Replace text in multiple Google Docs of a specific folder

99封情书 提交于 2021-01-07 06:57:05
问题 I've tried variations of code to get this to work, but nothing is working. Can anyone help? function pleaseWork() { var files = DriveApp.getFolderById("IDofFolder").getFilesByType(MimeType.GOOGLE_DOCS); while (files.hasNext()) { var file = files.next(); Logger.log(file.getName()); var doc = DocumentApp.openById(file.getId()); doc.replaceText("User Services", "Customer Success"); } Logger.log("Done") } 来源: https://stackoverflow.com/questions/65334592/replace-text-in-multiple-google-docs-of-a

Unable to open Google xlsx spreadsheet / Also Google Drive permission Blocked

假如想象 提交于 2021-01-07 06:31:11
问题 I have a Google Apps Script that I am currently using to successfully open a Google Sheets spreadsheet (read-only shared with my account) and perform some reading functions. I received another spreadsheet that I would like to run similar processes on. If I try: SpreadsheetApp.openById("_______") (which works on the other sheet), I get Exception: Service Spreadsheets failed while accessing document with id _____" with this sheet. This spreadsheet is actually an xlsx on Google Drive (but

Can't add line breaks to google script

Deadly 提交于 2021-01-07 04:37:35
问题 I have a google sheet with the text I wish to use in an email. The sheet has 50 rows and 3 columns of text, formatted as required. I have written code that will grab the sheet contents, but it doesn't have line feeds where I want them (funnily enough, at the end of the lines) It returns the sheet data as one lump of text. I have tried \n and char(10) var EmailLines = sSheet.getRange(startRow, startCol, numRows).getValues(); I thought it might be a simple add the LF at the end of each line but

Can't add line breaks to google script

﹥>﹥吖頭↗ 提交于 2021-01-07 04:36:32
问题 I have a google sheet with the text I wish to use in an email. The sheet has 50 rows and 3 columns of text, formatted as required. I have written code that will grab the sheet contents, but it doesn't have line feeds where I want them (funnily enough, at the end of the lines) It returns the sheet data as one lump of text. I have tried \n and char(10) var EmailLines = sSheet.getRange(startRow, startCol, numRows).getValues(); I thought it might be a simple add the LF at the end of each line but

Remove specific null items in an array in Google App Script

戏子无情 提交于 2021-01-07 03:10:13
问题 I've created a custom function to compile in one array data from different sheets in Google Sheets. Here is how it goes: function COMPILER(){ var i; var c; var display = []; var resultado = []; for (i = 0; i < arguments.length; i++) { display.push(arguments[i]); }; for (c = 0; c < display.length; c++) { resultado = resultado.concat(display[c]); }; return resultado; }; The code runs just fine, but I've ran into an unexpected issue. Since there are hidden formulas in between the data sources,

Sidebar in google sheets using apps script not working

丶灬走出姿态 提交于 2021-01-07 02:45:40
问题 I'm trying to build a sidebar in my google sheet and assign to it a script to send an emails. The problem is the title and close button displays correctly but the content of the sidebar is not displaying and it gives an error : "n-sf2kk5ynt6qhvo6tzp2uamld3a63ce7qvtsloby-0lu-script.googleusercontent.com took too long to respond." This is the code I used: interface.gs function onOpen() { SpreadsheetApp.getUi() // Or DocumentApp or SlidesApp or FormApp. .createMenu('Control Panel') .addItem(