google-apps-script

Query and compare date on google sheets

瘦欲@ 提交于 2020-02-25 17:06:31
问题 I'm working on making a replica of sheet1 on to another sheet2 (same document), and query() worked fine until the column i want to filter are formula cells (LONG ones each with query, match, etc). What i want to do is filter the rows in sheet1 where the event date in column M is upcoming (there are more filter conditions but just to simplify this is the main problem). I don't want the rows where the date is either empty, in the past (various date formats), or where the formula give a result

Google Sites: How to resize iframe based on the embedded content - Show full content instead of scrollbar

☆樱花仙子☆ 提交于 2020-02-25 11:48:25
问题 I am trying to create a google site with the google apps script where I am loading simple content from google sheet but after embedding the script url, the full content is loading within the the iframe fixed area with the vertical scrollbar. Is there any way we can dynamically change the iframe height to fit the content so that it looks like a part of the google site? Google Sites - Iframe with scrollbar 来源: https://stackoverflow.com/questions/60130123/google-sites-how-to-resize-iframe-based

How to update the data range of an existing graph using app script? [Google Sheets]

这一生的挚爱 提交于 2020-02-25 05:18:25
问题 I have created the script below, which runs from an onedit function for when cell J1 is edited. The graph exists in the sheet titled 'Daily Data'. The data it will be using is from a sheet titled 'Long Term Data'. I used the following link as guidance: https://developers.google.com/apps-script/reference/spreadsheet/embedded-chart. Thank you for any help. function onEdit(e) { //This IF statement ensures it will only run when cell J1 is edited: if ( e.source.getSheetName() == "Daily Data" && e

get and create new named versions of Google Spreadsheets in Google Apps Scripts

狂风中的少年 提交于 2020-02-25 04:17:49
问题 I am trying to find how to get named versions and create new named versions of Google Spreadsheet files in a Google Apps Script project. I checked https://developers.google.com/drive/api/v3/reference/revisions/list but it doesn't seem to return the named version name. Nor do I see a method to create a new named version. 来源: https://stackoverflow.com/questions/58146844/get-and-create-new-named-versions-of-google-spreadsheets-in-google-apps-scripts

Can anything done with google apps scripts be done with the google API?

冷暖自知 提交于 2020-02-25 04:15:27
问题 I noticed that the Google Apps Script editor uses a Bearer token to make requests for a lot of things, that got me thinking: Is it possible to do all functions that are done with the google apps script with the google API on your own server? What is the essential difference? Just the fact that google apps script runs on google servers, while with the google API you would need to create your own servers? For example many of the document functions, which I thought could only be done with the

Modify existing form Values - GetChoices() not working

爷,独闯天下 提交于 2020-02-24 16:16:47
问题 Why does '.getChoices()' not work for existing list items? I have the following code which gets an item in a form by it's ID, and I intend to update the values of the form item. However, when using the .getChoices() method, it fails with the error ' TypeError: Cannot find function getChoices in object Item. ' The item I'm fetching is a list item as required, and when a list item is created then fetched, it works normally as in the sample code listed here. My code is as follows: function

How to Save a JSON file in Google Apps Script?

岁酱吖の 提交于 2020-02-24 12:56:31
问题 I have a neural network script that requires training data from a JSON file, is it possible to save a json file on google app scripts? 回答1: You can use the Advanced Drive Service, which must be enabled. From the Apps Script code editor: "Resources" menu "Advanced Google Services" Find "Drive API" in the list Click the button to turn it ON In the past, you needed to also enable the Drive API in the Google Cloud Platform. But now you have two choices. Use the "default" Google Cloud project -

Google Apps Script: Calendar Service: Find first event in CalendarEventSeries

两盒软妹~` 提交于 2020-02-24 12:09:05
问题 I'd like to calculate the age of a person whose birthday exists as event series within my calendar. To do this I need to know the first event within this series and that's the question: how to get the first event of a series from an actual event? Thanks Ronny 回答1: The other answer doesn't actually answer the initial request, the CalendarApp has no method to get the start date of a recurring event. You should use the advanced Calendar API (must be enabled manually, see below and follow

Google App Script Web App GET and POST request blocked by CORS policy

淺唱寂寞╮ 提交于 2020-02-24 11:25:08
问题 I created a Google Web script app that adds a user's name and email to a spreadsheet. This works fine when accessing the web page from directly in the browser, but both GET and POST requests from a website returns the error "Access to fetch at 'https://script.google.com/macros/s/AKfycbxkG5hM6MMswwHdzWSJKwutMYsOZRT3zjC7jFti0sDvJ47bWB4BTsHPhvbyEVGSsSc5/exec' from origin '' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque

Many Chart options for EmbeddedChartBuilder.setOption() function not available to Google Apps Script

核能气质少年 提交于 2020-02-24 09:10:44
问题 I've created a simple script to create a chart on a sheet, using Sheet#newChart function buildVitalsChart(){ var ss = SpreadsheetApp.getActive(); var sh = ss.getSheetByName('Vitals Chart'); var rg = sh.getRange('A1:E'); var allChts = sh.getCharts(); var idA = []; for(var i = 0; i < allChts.length; i++){ sh.removeChart(allChts[i]); } SpreadsheetApp.flush(); var cht = sh.newChart() .asLineChart() .addRange(rg) .setPosition(2, 6, 0, 0) .setOption('title', 'Vitals') .build() sh.insertChart(cht);