google-apps-script

Invalid Argument with UrlFetch

旧城冷巷雨未停 提交于 2020-08-22 12:03:11
问题 I am trying to run a MongoLab (REST based access to MongoDB) query via Google Apps Script. The URL is generated from the logger is shown below https://api.mongolab.com/api/1/databases/abcd/collections/efgh?apiKey=XXXXXXXXXXXXXXXX&q={"created_on":{"$gte":"Thu Dec 06 00:00:00 PST 2012","$lt":"Thu Dec 06 23:59:59 PST 2012"}} When I type this in the browser, it works and gets me the response I am looking for. But running it via UrlFetchApp gives an "Invalid Argument" error. I see there are

How to convert LaTeX equation into editable equation using Google Apps Script

元气小坏坏 提交于 2020-08-22 04:54:15
问题 tldr: How can I convert a LaTeX equation in Google Docs so that it is editable as a Google Doc equation? Background: I want to import html into Google Docs. This HTML includes (in my native database) LaTeX equations. When I import to Google Docs, the LaTeX is converted into non-editable images. I want to convert the LaTeX into editable Google equations. I'm thinking I can use Google Apps Scripts to accomplish this. My plan is to insert the equations as a text-string "tag" such as [latex: x +

Facing issues while executing the App Scripts code for Google Sheets

…衆ロ難τιáo~ 提交于 2020-08-20 14:42:59
问题 I am facing few issues with the following scripts. Here the sheet name is 'Dashboard'. First paragraph under refreshSheet() is not working fine. The issues is: The following code is producing two protections of A1:K4 each time I run the code (Dashboard!A1:K4 and Dashboard!A1:K4). Should do only one protection each time. Please check the codes are as follows: function onEdit(e){ if (e.range.getA1Notation() === 'C6' && e.range.getValue() === "Start 1-Period") { refreshSheet(); onePeriod(); } if

XMLHttpRequest blocked by CORS policy when posting data to a Web App

不羁岁月 提交于 2020-08-20 12:11:09
问题 I get a CORS error response when I tried to post my data to my Google Spreadsheet via a Web App. This is the error I get: Access to XMLHttpRequest at 'myGoogleSpreadSheetApiURL' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. I did some solution, I searched on internet but I can't solve the issue... I could already get my JSON data

Notify via email when a cell is updated in google spreadsheet

旧街凉风 提交于 2020-08-20 11:41:33
问题 I am new to script and added this script which worked: function sendEmailAlert() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var cellValue = ss.getActiveSheet().getActiveRange().getA1Notation(); var getRow = ss.getActiveSheet().getActiveRange().getRow(); var sheetname = ss.getActiveSheet().getName(); var user = Session.getActiveUser().getEmail(); var Toemail = '....email address....'; var subject = 'New Entry -' + ss.getName(); var body = 'Your file has a new entry in - ' + sheetname +

Notify via email when a cell is updated in google spreadsheet

心已入冬 提交于 2020-08-20 11:41:32
问题 I am new to script and added this script which worked: function sendEmailAlert() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var cellValue = ss.getActiveSheet().getActiveRange().getA1Notation(); var getRow = ss.getActiveSheet().getActiveRange().getRow(); var sheetname = ss.getActiveSheet().getName(); var user = Session.getActiveUser().getEmail(); var Toemail = '....email address....'; var subject = 'New Entry -' + ss.getName(); var body = 'Your file has a new entry in - ' + sheetname +

Is there a way to use the same google-app-script in multiple different workbooks?

断了今生、忘了曾经 提交于 2020-08-20 11:19:16
问题 I have created 20+ Goolge Sheets workbooks. I have also written scripting to run each one. The one thing I would love to do is instead of have 20+ codes to run in each one, I would like to have 1 code that was used throughout each of my workbooks. Does anyone have any insite on how to make this happpen? I have tried using the library function. I am not sure if I am doing it correctly though. **//This is my Menu//** function onOpen() { var submenu = [{name: "Submit Order", functionName:

Can I make custom function on google spreadsheet without Google Apps Script?

梦想的初衷 提交于 2020-08-20 07:36:19
问题 I'm using google spreadsheet with Google Apps Script. but it gives me error message too easily. like this Error Script invoked too many times per second for this Google user account. (line 0). Is there any way to avoid the error? (except the way reduce function call) or alternative Spreadsheet program that support Javascript function define? 回答1: As noted in the documentation you can work around this by ensuring that your function supports ranges, and the function on a range. See also the

LockService lock does not persist after a prompt is shown

送分小仙女□ 提交于 2020-08-20 05:58:16
问题 I have a script in Google Sheets, which runs a function when a user clicks on an image. The function modifies content in cells and in order to avoid simultaneous modifications I need to use lock for this function. I cannot get, why this doesn't work (I still can invoke same function several times from different clients): function placeBidMP1() { var lock = LockService.getScriptLock(); lock.waitLock(10000) placeBid('MP1', 'I21:J25'); lock.releaseLock(); } placeBid() function is below: function

How to copy data from Gmail message attachment to a spreadsheet?

|▌冷眼眸甩不掉的悲伤 提交于 2020-08-20 05:41:13
问题 I'm trying to get the data out of a CSV report, located in a specific folder from a shared email and replace the old data from a specific tab in Google Sheets with new ones. I already tried different solutions, but none seems to get me where I want. The code below is the cleanest that I produced but, for some reason, is not doing anything. Steps that I followed: Open email where the folder is located(it is a shared email, managed in Gmail) Search for the folder where is located (label:rpt-its