google-apps-script

MailApp.sendEmail Error Message - “do not have permission to call sendEmail” [duplicate]

青春壹個敷衍的年華 提交于 2020-06-22 15:34:00
问题 This question already has an answer here : Not allowed to execute sendEmail() from custom function, but OK in script editor (1 answer) Closed 4 years ago . When I change something in my spreadsheet, the onEdit() trigger runs, and I can see all the msgbox's that I put in my code. My function stops at this line MailApp.sendEmail(emailAddress, subject, message); I never see the message 'Email sent!', and get an error in the EXECUTION TRANSCRIPT: You do not have permission to call sendEmail If I

Unable to change version of my Google Sheets Add-on

非 Y 不嫁゛ 提交于 2020-06-22 10:51:44
问题 I've made some bug fixes to a Google Sheets Add-on and now need to publish those changes. I've created a new version in my Script via File -> Manage versions. When I try to update my Add-on in the G Suite Marketplace SDK I get Error Sorry, there’s a problem. If you entered information, check it and try again. Otherwise, the problem might clear up on its own, so check back later. Tracking Number: 1747836347906634815 The only change we make is updating the version. This error has persisted for

How to solve common errors in Google Apps Script development [closed]

两盒软妹~` 提交于 2020-06-22 10:42:26
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 9 days ago . Improve this question The Q&A is currently a subject of meta discussion - please, do participate. Current plan is to split where possible (and no canonicals exist) into separate Q&As. The answer to the question is a community wiki and the question intended to become one when the

How do you resolve a “The parameters (number[]) don't match the method signature for SpreadsheetApp.Range.setValues” error

|▌冷眼眸甩不掉的悲伤 提交于 2020-06-20 19:06:26
问题 I am getting this error: "The parameters (number[]) don't match the method signature for SpreadsheetApp.Range.setValues." in my Google Apps Script when I try to write an array of values to a sheet. Below is a shortened (simplified) version of code. The actual code runs through about 10,000 records. The error is generated in the last line, when the setValues is called. I know I'm missing something super simple here. function writeArrayToSheet() { var ss = SpreadsheetApp.openById("Spreadsheet

You do not have permission to use copyTo

北城余情 提交于 2020-06-18 12:45:47
问题 I'm trying to copy a range from one sheet to another ( whilst preserving the formulas ). I wrote a simple script using copyTo : function copyRangeAcrossSheets(source_sheet,source_range,target_sheet,target_range) { var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); var source_sheet = spreadsheet.getSheetByName(source_sheet); var target_sheet = spreadsheet.getSheetByName(target_sheet); var source_range = source_sheet.getRange(source_range); var target_range = target_sheet.getRange(target

Custom function won't refresh as inputs are changed

痞子三分冷 提交于 2020-06-17 14:01:09
问题 I have a custom function that finds the value of another cell and displays it. When the source cell is changed, the function does not reflect. https://docs.google.com/spreadsheets/d/1wfFe__g0VdXGAAaPthuhmWQo3A2nQtSVUhfGBt6aIQ0/edit?usp=sharing Refreshing google sheets function findRate() { var accountName = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange(1,1).getValue(); //determine the account name to use in the horizontal search var rateTab = SpreadsheetApp

“Cannot call SpreadsheetApp.getUi() from this context” error while not using getUi() on time-based trigger

爷,独闯天下 提交于 2020-06-17 11:12:11
问题 I am trying to run a function every night that checks a list of dates and does work if it finds that a date has passed and all the checkboxes on that row are checked. Every day, though, I get an email saying "Cannot call SpreadsheetApp.getUi() from this context. (line 172, file "Code")". The weird thing is that I don't use getUi() anywhere in my CheckHireDates function and the line that it specifies is not even in the function that is supposed to run. Line 172 is in my onEdit function which

“Cannot call SpreadsheetApp.getUi() from this context” error while not using getUi() on time-based trigger

有些话、适合烂在心里 提交于 2020-06-17 11:06:08
问题 I am trying to run a function every night that checks a list of dates and does work if it finds that a date has passed and all the checkboxes on that row are checked. Every day, though, I get an email saying "Cannot call SpreadsheetApp.getUi() from this context. (line 172, file "Code")". The weird thing is that I don't use getUi() anywhere in my CheckHireDates function and the line that it specifies is not even in the function that is supposed to run. Line 172 is in my onEdit function which

“Cannot call SpreadsheetApp.getUi() from this context” error while not using getUi() on time-based trigger

丶灬走出姿态 提交于 2020-06-17 11:06:01
问题 I am trying to run a function every night that checks a list of dates and does work if it finds that a date has passed and all the checkboxes on that row are checked. Every day, though, I get an email saying "Cannot call SpreadsheetApp.getUi() from this context. (line 172, file "Code")". The weird thing is that I don't use getUi() anywhere in my CheckHireDates function and the line that it specifies is not even in the function that is supposed to run. Line 172 is in my onEdit function which

Delete rows based on values within cell, optimising

天涯浪子 提交于 2020-06-17 11:05:33
问题 I have script running on a weekly bases deleting rows from a document and then pasting these values to another sheet for data analysis, however as the document grows (+20,0000 rows) my script times out. Anyway on how to optimise the script to perhaps use less processing/memory and run faster? var rowsDeleted = 0; for (var i = 0; i <= numRows - 1; i++) { var row = values[i]; if (row[0] == 'delete' || row[0] == '') { data.deleteRow((parseInt(i)+1) - rowsDeleted); rowsDeleted++; } } 回答1: In your