google-apps-script

Gmail add-on connecting to non-Google Services without oAuth

自作多情 提交于 2020-07-09 11:50:12
问题 Is it possible to authenticate to third-party service in G-Suite (Gmail) Add-ons, but without oAuth . The service I want to authenticate works on REST API and has no oAuth support. The best for me would be to open a new window (as with oAuth), login there and return token to the Gmail add-on frame. If that won't be possible, I'd go with giving a username and password in dedicated Card in add-on, but I'm not sure it that solution will pass Google verification when publishing in Marketplace. I

Spreadsheet with conditional dropdown based on options from another sheet

我怕爱的太早我们不能终老 提交于 2020-07-09 11:48:01
问题 I have a destination sheet where in Col "B" there are a list of "Companies", in Col "K" I would to choose, with a dropdown, the "Address" available (of that specific "Company") taken from another sheet, located in col B and J. How to do this with a script? https://docs.google.com/spreadsheets/d/15g_3TMmVufKZogCbO3SUWBUp3iwc21nQgPBw6_GWXQQ/edit 回答1: I believe your goal as follows. You want to put the data validation rules to the column "K2:K" in the sheet destination . You want to create the

Spreadsheet with conditional dropdown based on options from another sheet

冷暖自知 提交于 2020-07-09 11:47:51
问题 I have a destination sheet where in Col "B" there are a list of "Companies", in Col "K" I would to choose, with a dropdown, the "Address" available (of that specific "Company") taken from another sheet, located in col B and J. How to do this with a script? https://docs.google.com/spreadsheets/d/15g_3TMmVufKZogCbO3SUWBUp3iwc21nQgPBw6_GWXQQ/edit 回答1: I believe your goal as follows. You want to put the data validation rules to the column "K2:K" in the sheet destination . You want to create the

Gmail add-on connecting to non-Google Services without oAuth

冷暖自知 提交于 2020-07-09 11:47:41
问题 Is it possible to authenticate to third-party service in G-Suite (Gmail) Add-ons, but without oAuth . The service I want to authenticate works on REST API and has no oAuth support. The best for me would be to open a new window (as with oAuth), login there and return token to the Gmail add-on frame. If that won't be possible, I'd go with giving a username and password in dedicated Card in add-on, but I'm not sure it that solution will pass Google verification when publishing in Marketplace. I

Script fails on SpreadsheetApp.openById - Requires permission

让人想犯罪 __ 提交于 2020-07-09 08:54:12
问题 I have an onOpen function that creates a custom menu in a spreadsheet. It's been working fine for over a year, but a couple days ago it stopped working. When I look at the execution transcript I get: "Execution failed: You do not have permission to call SpreadsheetApp.openById. Required permissions: https://www.googleapis.com/auth/spreadsheets" This fails/relates to the below line of code: var ss = SpreadsheetApp.openById("myID") I've checked what API's are enabled, and I have Sheets enabled,

Generate new spreadsheet from a selected row based on template

十年热恋 提交于 2020-07-09 08:40:38
问题 With this script I can generate new tab from all the row in a spreadsheet: function onOpen() { SpreadsheetApp.getUi().createMenu('Tab Orari') .addItem('Genera Tab Orari', 'createTabs') .addToUi()} function createTabs() { var ss = SpreadsheetApp.getActive(); var templateSheet = ss.getSheetByName('xxx'); ss.getSheetByName('Generale').getRange('I2:I').getValues().filter(String) .forEach(function (sn) { if (!ss.getSheetByName(sn[0])) { ss.insertSheet(sn[0], ss.getSheets().length, {template:

How to add a table of contents to Google Sheets

拈花ヽ惹草 提交于 2020-07-09 08:07:53
问题 I'm trying to add a table of contents to Google Sheets : simply want to include a list of all sheets inside the document, as clickable links (got 150+ sheets.) I got it to work, but it's more complicated than I'd like, and leaves me with questions about custom functions in Google Sheets. Here's what I have, set of course in Tools › Script editor : /** * Returns all the document's sheet IDs. * * @return * @customfunction */ function tocid() { var out = new Array() var sheets = SpreadsheetApp

How to add a table of contents to Google Sheets

我们两清 提交于 2020-07-09 08:07:13
问题 I'm trying to add a table of contents to Google Sheets : simply want to include a list of all sheets inside the document, as clickable links (got 150+ sheets.) I got it to work, but it's more complicated than I'd like, and leaves me with questions about custom functions in Google Sheets. Here's what I have, set of course in Tools › Script editor : /** * Returns all the document's sheet IDs. * * @return * @customfunction */ function tocid() { var out = new Array() var sheets = SpreadsheetApp

“Service Spreadsheets failed” error when calling openById method in a standalone script project

故事扮演 提交于 2020-07-09 06:46:05
问题 I've been trying to access spreadsheets from a standalone google script, but keep getting the following error message: Exception: Service Spreadsheets failed while accessing document with id abcdefg_example_id. (Code:25:33) function doSomething() { var theSheet = SpreadsheetApp.openById("abcdefg_example_id"); if(theSheet == null){ Logger.log("NO SPREADSHEET"); } else { Logger.log("SPREADSHEET REEE"); } Logger.log(theSheet.getName()); } How do I access a spreadsheet by ID from a standalone

List all files and folder in google drive

醉酒当歌 提交于 2020-07-09 06:25:52
问题 I've been trying to figure this out for a while now. I hope I can get some guidance on this. The purpose of the following script is to get a full list of folders and files with subfolders and their files included. Here is what I currently have: var counter = 0 var files = folder.getFiles(); var subfolders = folder.getFolders(); var folderPath = folder.getName(); while (subfolders.hasNext()){ subfolder = subfolders.next(); var row = []; //row.push(subfolder.getName(),'',subfolder.getId()