google-apps-script

onSubmit form validation

独自空忆成欢 提交于 2020-08-11 18:10:26
问题 I am working on Google Forms, I look into the available events and there are only two; open and onSubmit I want to stop form submission if one of my validation criteria fails that would be specified on my app script for the form onSubmit trigger. For example, I want to fetch the value of one of the fields and compare it to a list of values in a spread sheet if the value in the form is found in the spread value list then proceed to form submission otherwise prompt user to resubmit form. Is

Distances in google sheets

落花浮王杯 提交于 2020-08-11 18:01:07
问题 I have a set of 20,000 addresses and I need to find the distance between those and a set address. The program works but I keep encountering the "service invoked too many times in one day" error message. Does anyone know if there is a way to buy more "queries" from google? Thanks! Code I am using: function DrivingMeters(origin, destination) { var randnumber = Math.random()*10000; Utilities.sleep(randnumber); var directions = Maps.newDirectionFinder() .setOrigin(origin) .setDestination

Distances in google sheets

对着背影说爱祢 提交于 2020-08-11 17:58:36
问题 I have a set of 20,000 addresses and I need to find the distance between those and a set address. The program works but I keep encountering the "service invoked too many times in one day" error message. Does anyone know if there is a way to buy more "queries" from google? Thanks! Code I am using: function DrivingMeters(origin, destination) { var randnumber = Math.random()*10000; Utilities.sleep(randnumber); var directions = Maps.newDirectionFinder() .setOrigin(origin) .setDestination

Run trigger at specific date and time

我是研究僧i 提交于 2020-08-11 07:30:26
问题 I want to run a trigger at specific date and time (+or - 15 min). I have a date min string with YYYY-MM-DD HH:MM format say 2017-04-01 18:05 How will I modify the below script to run at 18 hours and 5 minutes. var triggerDay = new Date(2017, 04, 01); ScriptApp.newTrigger("myFunction") .timeBased() .at(triggerDay) .create(); 回答1: You can try this: function createTimeDrivenTriggers() { // Trigger on 2017-04-01 around 18:00 (±15 min). ScriptApp.newTrigger('myFunction') .timeBased() .atDate(2017,

Exception: The number of columns in the data does not match the number of columns in the range despite the range being created from data

怎甘沉沦 提交于 2020-08-10 23:43:36
问题 I'm trying to figure out what I'm missing here in this Google script. I keep getting the error Exception: The number of columns in the data does not match the number of columns in the range. The data has 0 but the range has 15. but it doesn't make sense to me. Here's the bit of code in question: var range = ReleaseSchedule.getRange(1,1,output_data_sheet.length,output_data_sheet[0].length); range.setValues(output_data_sheet); ReleaseSchedule is a new sheet in the active spreadsheet output_data

Exception: The number of columns in the data does not match the number of columns in the range despite the range being created from data

怎甘沉沦 提交于 2020-08-10 23:39:29
问题 I'm trying to figure out what I'm missing here in this Google script. I keep getting the error Exception: The number of columns in the data does not match the number of columns in the range. The data has 0 but the range has 15. but it doesn't make sense to me. Here's the bit of code in question: var range = ReleaseSchedule.getRange(1,1,output_data_sheet.length,output_data_sheet[0].length); range.setValues(output_data_sheet); ReleaseSchedule is a new sheet in the active spreadsheet output_data

Issues with global variables in Google App Script

烂漫一生 提交于 2020-08-10 23:02:55
问题 I'm trying to receive some data being sent to a webhook and work with it. I'm able to receive the data and convert it to a json String however I want to assign the json String to a global variable so I can use it elsewhere, and in other functions. I'm declaring the variable first and then trying to assign the json string to it when i receive it but it doesn't seem to be working - the variable is still 'undefined' var jsonData; function doPost(e){ try{ var jsonString = e.postData

Issues with global variables in Google App Script

荒凉一梦 提交于 2020-08-10 22:59:46
问题 I'm trying to receive some data being sent to a webhook and work with it. I'm able to receive the data and convert it to a json String however I want to assign the json String to a global variable so I can use it elsewhere, and in other functions. I'm declaring the variable first and then trying to assign the json string to it when i receive it but it doesn't seem to be working - the variable is still 'undefined' var jsonData; function doPost(e){ try{ var jsonString = e.postData

How can i get data from a JSON array in google app script?

只谈情不闲聊 提交于 2020-08-10 22:11:29
问题 I'm doing a request to an API that is successful but i need to get the data of the array returned, below i will put how the array looks like so you can help me to extract the data { total_grand: 30600000, total_billable: null, total_currencies: [ { currency: null, amount: null } ], total_count: 5, per_page: 50, data: [ { id: 13998122, pid: 1570982183, tid: null, uid: 5386231, description: 'Finish the first part of the RCP mockup', start: '2020-03-26T13:00:00-04:00', end: '2020-03-26T16:00:00

How to download My Html table data into googlesheets or csv using javascript

烈酒焚心 提交于 2020-08-10 20:28:08
问题 Earlier My code that I got from google search was working fine. But suddenly it has stopped working. My simple objective is to download my HTML table into csv or Googlesheets file. How can I achieve this? Here is my html code <div class="container"> <div style="width: auto; height: 600px; overflow:scroll;"> <table class="containers" width="100" id="myTable"> <thead id="thead1"> </thead> <tbody id="perf"> </tbody> </table> </div> <div class="row"> <button id="btn" onclick="exportTableToCSV(