google-apps-script

How do I avoid overwritting a row in google sheet while seting values from API response

烂漫一生 提交于 2020-05-15 09:26:05
问题 I have a JavaScript code that gets response from API and sets the values on google spreadsheet. The data that I get are users on a project that I need recorded to a sheet in spreadsheet. The only challenge that I need help is avoiding overwriting existing sheet data on subsequent loop, how can I handle this ? This first part gets project codes and uses it to make API call where the teams on all the projects are contained in a response. function readDates() { var ss = SpreadsheetApp

Searching through a Range with TextFinder is slower than searching the entire Sheet

元气小坏坏 提交于 2020-05-15 08:42:51
问题 I have a sheet with a lot of rows -- thousands. I want to search a specific column for text. I am using Range.createTextFinder but it times out. It even times out if the Sheet only has 4 rows of data. // This is very slow var found = sheet.getRange("A:A").createTextFinder("dog").matchCase(false).findNext(); If I search the entire sheet it is pretty fast but I want to only check a specific column. // This works faster but it searches the entire sheet var found = sheet.createTextFinder("dog")

CLASP Local Login

一世执手 提交于 2020-05-15 06:52:05
问题 I'm trying to figure out how to set up a local login file for my google scripts project in order to set it up so it'll work in an automated deploy process. As far as I can tell, clasp login will create a file in your home directory which authenticates you with scripts.google.com, but that file isn't applicable to to local logins because it's missing some properties like "project_id". When looking for how to create a file to run with clasp login --creds {file} there doesn't seem to be a

Trying to pull stock quote info from TDAmeritrade with Google Script with API needing authentication

。_饼干妹妹 提交于 2020-05-15 05:45:26
问题 I'm using an API from TD Ameritrade to pull stock ticker information. The script needs authentication to pull real time data. The CURL command is as follows: curl -X GET --header "Authorization: " --header "Authorization: Bearer " "https://api.tdameritrade.com/v1/marketdata/AAPL/quotes?apikey=" I'm using a Google Script to read the data from the API, do some calculations, and then write the data to a Google Sheet. Below is the script to authenticate, and it doesn't work. Note that my access

Add container-bound script to a Google Docs file programmatically

人走茶凉 提交于 2020-05-15 05:43:18
问题 I am uploading files to Google Drive using the Drive REST API. I would like to have some default add-ons enabled on those files by default. I was reading about container-bound scripts here. But it is only possible to add container-bound script after opening the file in Google Docs UI. Is there any way to bind a script to a file while uploading or after uploading programmatically? 回答1: You can create the project of container-bound script type in Google Docs using Apps Script API. And when you

Split Lines and Bold Text within a ui.alert Window in Google Apps Script

大兔子大兔子 提交于 2020-05-15 05:29:22
问题 I feel like this should be pretty simple, but I can't find anything about it. I want my message that pops up in a ui.alert window to bold certain words and split a string at , into new lines. Here is the code I have: function send(){ var ui = SpreadsheetApp.getUi(); var bccSend = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('main_gen').getRange(2,2).getValue(); //value example is xxx@gmail.com, yyy@gmail.com var bccSendReplace = bccSend.toString().replace(/,/g,"<br>"); var response =

Highlight entire row when cell is active

一世执手 提交于 2020-05-14 14:41:34
问题 How to design a sheet script that would result in an active row being highlighted? I would like to have an entire row change color of font or background when one cell in that row is active. I don't want the trigger to be any specific value in the cell, just clicking on a cell should trigger the highlight for the whole row that cell belongs to. 回答1: Sorry, this can't be done with conditional formatting or script by just selecting a cell. You can, however, highlight an entire row of the active

Can I have part of Google Apps Script code execute as me while the rest executes as the accessing user?

ⅰ亾dé卋堺 提交于 2020-05-14 10:24:19
问题 I have a apps script web app that writes to a fusion table, as well as a few spreadsheets which it periodically caches. I do not want to provide edit access to the fusion table to colleagues, who could just go and edit entries as they see fit. Currently the web app executes as the user, for anyone within my organization, which is the intention. However, I'd rather the web app execute any queries as myself, so that I don't need to explicitly provide permissions to each individual user that

Can I have part of Google Apps Script code execute as me while the rest executes as the accessing user?

安稳与你 提交于 2020-05-14 10:20:27
问题 I have a apps script web app that writes to a fusion table, as well as a few spreadsheets which it periodically caches. I do not want to provide edit access to the fusion table to colleagues, who could just go and edit entries as they see fit. Currently the web app executes as the user, for anyone within my organization, which is the intention. However, I'd rather the web app execute any queries as myself, so that I don't need to explicitly provide permissions to each individual user that

Can I have part of Google Apps Script code execute as me while the rest executes as the accessing user?

喜夏-厌秋 提交于 2020-05-14 10:20:07
问题 I have a apps script web app that writes to a fusion table, as well as a few spreadsheets which it periodically caches. I do not want to provide edit access to the fusion table to colleagues, who could just go and edit entries as they see fit. Currently the web app executes as the user, for anyone within my organization, which is the intention. However, I'd rather the web app execute any queries as myself, so that I don't need to explicitly provide permissions to each individual user that