custom-function

Script to summarise data not updating

那年仲夏 提交于 2019-12-17 03:43:48
问题 I have a Google spreadsheet of timesheet data; it has a sheet for each month, each sheet is a lot of six column blocks, one block per client. I have created a summary sheet that goes and gets the total for each clients and displays it in a list: function getClientTotals(sheetname, colcount) { colcount = colcount ? colcount : 6; var res; var ss = SpreadsheetApp.openById('myid_goes_here'); if(ss) { res = []; var totrow = ss.getRange(sheetname + '!A1:ZZ1').getValues()[0]; for(var i = 0; i <

Script to summarise data not updating

懵懂的女人 提交于 2019-12-17 03:43:09
问题 I have a Google spreadsheet of timesheet data; it has a sheet for each month, each sheet is a lot of six column blocks, one block per client. I have created a summary sheet that goes and gets the total for each clients and displays it in a list: function getClientTotals(sheetname, colcount) { colcount = colcount ? colcount : 6; var res; var ss = SpreadsheetApp.openById('myid_goes_here'); if(ss) { res = []; var totrow = ss.getRange(sheetname + '!A1:ZZ1').getValues()[0]; for(var i = 0; i <

Google sheets custom function error “Result was not a number”

寵の児 提交于 2019-12-13 03:33:37
问题 I have a Google Sheets Apps Script custom function that produces the error: "Result was not a number" . The value returned from the custom function although a number is not being treated as a number regardless of the 'format' applied to the cell. The calculated values cannot then be used in other built-in functions such as SUM(). Similar questions have been asked, see here, here, and here (and probably others...) but don't explain how to change the return type. The google apps-script

How to create a custom function that returns data to multiple cells

女生的网名这么多〃 提交于 2019-12-11 16:11:22
问题 I need to create a custom function in Google Apps Script that will allow me to input the location of certain cells and then the function would output into new cells. This is what I tried sofar: function SetRange(RowNum) { var app = SpreadsheetApp; var ss = app.getActiveSpreadsheet(); var sheet = ss.getActiveSheet(); sheet.getActiveCell(),setValue(45) sheet.getRange(RowNum,24),setValue(51); } I get the error that "SetValue is not defined. I am building this program as I learn so there are some

UrlFetch failed because too much traffic is being sent to the specified URL

空扰寡人 提交于 2019-12-11 04:36:51
问题 I'm writing a script for Google Sheets that uses Facebook's Graph API to get my data. Everything worked earlier today but suddenly I'm getting an error: UrlFetch failed because too much traffic is being sent to the specified URL. I haven't hit any quotas about using UrlFetch because I can still fetch from other urls that are not graph.facebook.com - so the issue appears to be specifically with Facebook. Script Code var myClientID = ''; var myClientSecret = ''; var myAccessToken = ''; var

How to use for to sum a range in google app script?

[亡魂溺海] 提交于 2019-12-11 03:47:08
问题 I want create a simple custom sum formula in google Spreadsheets using google app Script. function somaDias(range, days) { var sum = 0; for(i=0; i<days; i++){ sum = sum + range[i]; } return soma; } I will use this function in a report that has a column with monetary values for each day of the month. The idea is to select the whole column of values, pass it as a range and them sum this values up to a day of the month. I know there is something wrong with sum = sum + range[i]; because, when I

Google spreadsheet custom function: How to get a continuously updated valued?

*爱你&永不变心* 提交于 2019-12-11 02:54:44
问题 I wrote a custom google app script function in a script associated with my google doc spreadsheet. The function calls a third party service to get data. I can put the function in a cell: =myfunction("something") and it returns the correct value from the service. However, how can I keep this value updated so that it's showing the latest data from the service? Update For example: =temperature("90120") For getting the current temperature in a given zip code. Also my sheet may have dozens or

How do I make Google Sheets refresh every 60 seconds?

邮差的信 提交于 2019-12-11 01:13:55
问题 I have an ImportJSON script in my Google Sheets retrieved from here. Now I have code: =ImportJSON("http://date.jsontest.com/","/time", "") which simply retrieves the time right now. My issue is that it does not refresh automatically. How do I make it refresh every 60 seconds? 回答1: I use a refresh script with the google apps script. First you need to generate a random number to trick it into thinking its a new link. var min = Math.ceil(0); var max = Math.floor(99); var randomNum = Math.floor

google sheets custom function built-in function

∥☆過路亽.° 提交于 2019-12-10 23:29:20
问题 I have following custom function in google sheets, I tried to call a built-in function "TEXT" in my custom function but it is not successful. The Google sheets will prompt "unknown" function "TEXT". Is there solution? Tks Leon function NextMonth(StockTradeDate) { var DeltaDate; if (**TEXT**(StockTradeDate,"mmm") = "JAN" ) { DeltaDate = 30; } return DATEVALUE(StockTradeDate) + 31; } 回答1: Try using javascript date methods (as below) to drive the date and conditionals you need. Could not locate

Custom parsing function PHP

◇◆丶佛笑我妖孽 提交于 2019-12-07 13:02:40
问题 I'm trying to remove eval from the following function. I tried with sprintf and ${} , but still cannot find a solution. Here the function: function parseDbString(string $value = 'Looking for a good {{ $pippo }}'){ $pippo='Pizza'; return preg_replace_callback('/{{(.*?)}}/', function($res) use ($pippo) { // $val=${trim($res[1])}; Returns "Undefined variable: $pippo" $val=@eval("return ".trim($res[1]).";"); // Returns "Looking for a good Pizza" return isset($val) ? $val : $res[0]; },$value); }