google-apps-script

How to authorize scope for GAS to edit Google Spreadsheets

♀尐吖头ヾ 提交于 2020-04-16 03:12:08
问题 I have a Powershell script that calls a Google App Script function. When I run the Powershell script I can see the following error on the Error Reporting on my GCP project: Exception: You do not have permission to call SpreadsheetApp.getActiveSpreadsheet. Required permissions: (https://www.googleapis.com/auth/spreadsheets.currentonly || https://www.googleapis.com/auth/spreadsheets) at toSpreadsheet (Código:3) at fromPS (Código:14) I have understood that I have to authorize the scope, so I've

Can I add a Trigger based on change of a particular cell?

我只是一个虾纸丫 提交于 2020-04-16 02:56:36
问题 I have a script that is currently set to run onEdit. Ideally, I'd like the script to run ONLY when someone makes a change to cell B26 of the sheet in question. Is this possible? 回答1: This is code taken directly from the documentation: function onEdit(e){ // Set a comment on the edited cell to indicate when it was changed. var range = e.range; range.setNote('Last modified: ' + new Date()); } It already has e.range in it. All you need to do is add and if statement, and get the cell address of

Search bigquery for messageid from my gmail account

情到浓时终转凉″ 提交于 2020-04-16 02:55:21
问题 I want to search bigquery gmail logs for a particular messageid from my email account. function myFunction() { // Get the first message in the first thread of your inbox var message = GmailApp.getInboxThreads(0, 1)[0].getMessages()[0]; // Get its ID var messageId = message.getId(); // Now fetch the same message using that ID. var messageById = GmailApp.getMessageById(messageId); // Should always log true as they should be the same message var messageIdRFC2822 = message.getHeader("Message-ID")

Share data from .gs (Google Apps Script) to <script> variable in html

一笑奈何 提交于 2020-04-16 02:53:05
问题 [ {"id":1,"label":"Node 2"}, {"id":2,"label":"Node 3"}, {"id":3,"label":"Node 4"}, {"id":4,"label":"Node 5"} ] Hi! In the following code, the function getArray() returns this string ↑. Do you know how to connect it with the variable nodes in the .html . I pasted the codes, Thanks! function getArray(){ var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); const data = ss.getRange(1,1,ss.getLastRow()-1,2).getValues(); let objArray = [] data.forEach(element => { let obj = {} obj.id =

How can I add a horizontal scrollbar in the google sheet similar to form control scrollbar in excel?

狂风中的少年 提交于 2020-04-16 00:59:13
问题 I would like to add a horizontal scrollbar that will provide the values 0-365 based on its position and use this value for calculation. I am creating a Gantt chart, the same as is on the page https://www.vertex42.com/ExcelTemplates/excel-gantt-chart.html There is a horizontal scrollbar that helps "to move" with the calendar. I have put there a number that I must change manually. I haven't found any solution on the internet. 回答1: This kind of control is simply not available natively within

REST API failure: Invoke-WebRequest : 404

半腔热情 提交于 2020-04-15 17:18:17
问题 The Powershell code bellow writes and reads values to Google Sheets (works fine) and should run the function myfunction in an Apps Script project using API, but Invoke-WebRequest returns the error bellow: Invoke-WebRequest : 404. That’s an error. The requested URL /v1/scripts/=ya29.a0Ae4lvC3k8aahOCPBgf-tRf4SRFxdcCE97fkbXLAJqZ4zRCLnBp9prwEcBYBAf lYP6zyW3fLeD3u4iSw5jYtDAdgZiSsTjzQbCpj9e_ahCA0xwC_1NBTjYkPwqFdLli7LNpfFcuedFDhdUpfnKTRZdbBWIf2ZyxyuGc6p was not found on this server. That’s all we

REST API failure: Invoke-WebRequest : 404

我只是一个虾纸丫 提交于 2020-04-15 17:13:23
问题 The Powershell code bellow writes and reads values to Google Sheets (works fine) and should run the function myfunction in an Apps Script project using API, but Invoke-WebRequest returns the error bellow: Invoke-WebRequest : 404. That’s an error. The requested URL /v1/scripts/=ya29.a0Ae4lvC3k8aahOCPBgf-tRf4SRFxdcCE97fkbXLAJqZ4zRCLnBp9prwEcBYBAf lYP6zyW3fLeD3u4iSw5jYtDAdgZiSsTjzQbCpj9e_ahCA0xwC_1NBTjYkPwqFdLli7LNpfFcuedFDhdUpfnKTRZdbBWIf2ZyxyuGc6p was not found on this server. That’s all we

Response and Error handling in Google Apps Scripts. doPost? withFailureHandler()?

风流意气都作罢 提交于 2020-04-15 15:43:43
问题 I hope everyone is safe and healthy given the current situation. I have a question in regards to a project with google apps script. I have a web app and I have been able to figure out routing with doGet() using links etc. //global variables const sheetId = "foo"; const Route = {}; Route.path = function(route, callback){ Route[route] = callback; } function doGet(e){ Route.path("newAccountForm",loadNewForm); Route.path("updateBrandForm", loadUpdateForm); if(Route[e.parameters.v]) { return Route

Response and Error handling in Google Apps Scripts. doPost? withFailureHandler()?

元气小坏坏 提交于 2020-04-15 15:43:42
问题 I hope everyone is safe and healthy given the current situation. I have a question in regards to a project with google apps script. I have a web app and I have been able to figure out routing with doGet() using links etc. //global variables const sheetId = "foo"; const Route = {}; Route.path = function(route, callback){ Route[route] = callback; } function doGet(e){ Route.path("newAccountForm",loadNewForm); Route.path("updateBrandForm", loadUpdateForm); if(Route[e.parameters.v]) { return Route

Script to run on specific sheet

て烟熏妆下的殇ゞ 提交于 2020-04-14 08:56:15
问题 I have a script that I have been using, but it only works with, as written, the active sheet (pulls a list of documents from the specified directory in Google Drive). How can transform this to run on a specific sheet. The name of the sheet is "Per 7". function list_all_files_inside_one_folder_without_subfolders(){ var sh = SpreadsheetApp.getActiveSheet(); var folder = DriveApp.getFolderById('0B4zzmqQYDRm2flZPRFVWd1FfSGpJTXFmcWlSLXVVTUZJRjNlU3QzTER6aHFsYVEzTDdrS00'); // I change the folder ID