google-apps-script

Using AuthToken obtained via ScriptApp.getAuthToken() to call web apps in GAS

淺唱寂寞╮ 提交于 2020-06-16 07:37:07
问题 I created 2 simple standalone scripts to test the authorization workflow. The first script is a web app that is accessible only to me. function doGet(e) { return ContentService.createTextOutput(JSON.stringify({"message":"works!"})) .setMimeType(ContentService.MimeType.JSON); } The calling script gets the token via ScriptApp.getAuthToken() and makes a 'GET' request to the web app. function call() { var token = ScriptApp.getOAuthToken(); var header = {"Authorization":"Bearer " + token}; var

How do I add a new value to the end of a column in Google Sheets?

断了今生、忘了曾经 提交于 2020-06-16 05:42:21
问题 I'm trying to figure out how to add a value to the last row in a specific column in Google Sheets. Not all columns in the spreadsheet/table are of equal length so I can't simply look for the last row and add to a column. I need to find the next empty cell in a column and add the new value there. Looking through the docs I think involves the getRange() and setValue() functions but I think setting the actual range requires some additional coding to determine the next empty cell. Once I get that

How do I add a new value to the end of a column in Google Sheets?

谁说我不能喝 提交于 2020-06-16 05:41:53
问题 I'm trying to figure out how to add a value to the last row in a specific column in Google Sheets. Not all columns in the spreadsheet/table are of equal length so I can't simply look for the last row and add to a column. I need to find the next empty cell in a column and add the new value there. Looking through the docs I think involves the getRange() and setValue() functions but I think setting the actual range requires some additional coding to determine the next empty cell. Once I get that

Update/edit google sheets row values from html input

北战南征 提交于 2020-06-16 04:40:29
问题 I have an html form where the client's data is inserted in and it appends row with the values on to a google sheet. In the form, there's a field that searches and returns the clients data when searching for a specific value (id number). function getID(IDsearch){ var ws = SpreadsheetApp.getActiveSheet(); var data = ws.getRange(3, 1, ws.getLastRow(), 36).getValues(); var dataInput = data.map(function(r){return r[7];}); var position = dataInput.indexOf(IDsearch); var dataArray = ws.getRange

Update/edit google sheets row values from html input

有些话、适合烂在心里 提交于 2020-06-16 04:40:07
问题 I have an html form where the client's data is inserted in and it appends row with the values on to a google sheet. In the form, there's a field that searches and returns the clients data when searching for a specific value (id number). function getID(IDsearch){ var ws = SpreadsheetApp.getActiveSheet(); var data = ws.getRange(3, 1, ws.getLastRow(), 36).getValues(); var dataInput = data.map(function(r){return r[7];}); var position = dataInput.indexOf(IDsearch); var dataArray = ws.getRange

Dynamic namedRange, Trying to print only cells with data in them

独自空忆成欢 提交于 2020-06-16 03:34:07
问题 function readNamedRange() { var app = SpreadsheetApp; var activeSheet = app.getActiveSpreadsheet().getActiveSheet(); var listDown = activeSheet.getRange("listDown"); var result = activeSheet.getRange("listDown").getValues(); } In the above code, my active sheet contains a namedRange which has the entire B column set to the namedRange called listDown . Cells B1 to B10 have data 1 through 10 in them. I am trying to print only data cells with values in them using both for loop and an if

Retrieving the link to a response from a Google Form

僤鯓⒐⒋嵵緔 提交于 2020-06-16 00:36:11
问题 I have a script attached to a Google Form which sends a notification to a Discord channel on submission. I want to include a direct link to the individual response (link looks like https://docs.google.com/forms/d/<myformid>/edit#response=<responseid> ). How can I retrieve that link? I get part of the link up to /edit with Form.getEditUrl() but I can't get the correct id. I checked FormResponse.getId() but that doesn't link me to any response. Here's how to get to that link manually via edit

Can't have link in Embedded web app in Google site?

允我心安 提交于 2020-06-14 03:26:55
问题 I'm trying to integrate a google script app deployed as a web app in a Google Site. The embedding feature works well and all seems good at first. But for some reason links don't work in the embedded view. I can't find any specific topics about this. Google Script web app can be embedded every where I tried except in Google Site. And Google Site can embed every site that allow it except web app from google script.(couldn't figure out what you trying to say here...Cooper) EDIT (2) Turn out the

Script to convert .XLSX to Google Sheet and move converted file

◇◆丶佛笑我妖孽 提交于 2020-06-13 11:18:32
问题 I know it is possible to convert excel files to Google Sheets using script and drive API, but I'm looking for script to convert the excel sheet and move the converted file to a different folder. So the required steps are as follows: Convert excel (.xls/.xlsx) to Google Sheet from FolderA. Move converted file from FoldarA to FolderB. Delete original excel file from FolderA Hopefully step 3 avoids this, but avoid duplicating already converted file. The excel files are being pasted into a local

Google calendar events to Google spreadsheet automatic refresh onEdit

最后都变了- 提交于 2020-06-13 10:48:54
问题 I am trying to grab time events from my Google Calendar into a Google Spreadsheet. When a new time-event is created in my Google Calendar this event should be automatically synchronized into my Google Spreadsheet. This should be done automatically by an onEdit event trigger. At the moment it is only running by refreshing the Google Spreadsheet. Maybe someone has a better solution for my challenge. Here is my code: function createSpreadsheetEditTrigger() { var ss = SpreadsheetApp.getActive();