custom-function

IMPORTJSON custom function google sheets

前提是你 提交于 2020-01-06 05:09:06
问题 /** * Imports JSON data to your spreadsheet Ex: IMPORTJSON("http://myapisite.com","city/population") * @param url URL of your JSON data as string * @param xpath simplified xpath as string * @customfunction */ function IMPORTJSON(url,xpath){ try{ // /rates/EUR var res = UrlFetchApp.fetch(url); var content = res.getContentText(); var json = JSON.parse(content); var patharray = xpath.split("/"); //Logger.log(patharray); for(var i=0;i<patharray.length;i++){ json = json[patharray[i]]; } //Logger

Calling a Google App Script library from a Google spreadsheet cell

不问归期 提交于 2020-01-02 06:50:47
问题 Trying out the new library feature in a Google spreadsheet. I have include a library with the identifier of "Test" and the library implements the function "foo()" entering =Test.foo() into a spreadsheet cell gives the error : "unknown function name TEST.FOO" If I create a function in my spreadsheet to wrap the library function: function foo() { return Test.foo(); } then use =foo() in my speadsheet cell, all is well. Creating wrapper functions for all library functions so they can be used in a

Google Apps Script to VMerge tables WITH FORMATTING

霸气de小男生 提交于 2019-12-30 13:12:52
问题 Does anyone know if there is a Google apps script out there that does what VMerge does but keeps the formatting of the tables being merged together? (in Google Spreadsheets) VMerge is a script that can be used as a custom formula but a script that I can trigger myself will do just fine too. Any help would be much appreciated. 回答1: If you need a separate script to bring over the formatting... function myFunction() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var s = ss.getSheetByName(

Google Spreadsheet custom function made of built in spreadsheet functions

北城余情 提交于 2019-12-28 18:19:25
问题 I have following function in a cell. It reads date from other cell, than calculates age and transforms it in format "3 weeks 5 days" =INT((TODAY()-D19)/7)&" weeks, "&(TODAY()-D19-(INT((TODAY()-D19)/7)*7))&" days" It works. Now I would like to replace this long string into one simple function: =AGEINWEEKS(D19) How can I do that? I already tried to write this script in Script Editor function ageInWeeks(from_date) { return SpreadsheetApp.getActiveSheet().getRange("D16").setFormula('=ROUND((TODAY

No Permission to call setValues() - Google Apps Script, JSON data [duplicate]

血红的双手。 提交于 2019-12-25 17:13:05
问题 This question already has an answer here : No permission to call msgBox in Google Apps Scripting (1 answer) Closed 3 years ago . This is a Google Apps Script that pulls JSON data into Google Sheets. The code is: function pullJSON() { var url="https://api.myjson.com/bins/4610d"; // publicly available json var response = UrlFetchApp.fetch(url); // var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1"); var dataAll = JSON.parse(response.getContentText()); var dataSet =

No Permission to call setValues() - Google Apps Script, JSON data [duplicate]

时光毁灭记忆、已成空白 提交于 2019-12-25 17:13:04
问题 This question already has an answer here : No permission to call msgBox in Google Apps Scripting (1 answer) Closed 3 years ago . This is a Google Apps Script that pulls JSON data into Google Sheets. The code is: function pullJSON() { var url="https://api.myjson.com/bins/4610d"; // publicly available json var response = UrlFetchApp.fetch(url); // var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1"); var dataAll = JSON.parse(response.getContentText()); var dataSet =

Custom function in Controller with resource wont work

烈酒焚心 提交于 2019-12-24 20:01:03
问题 I have created my own custom function in my RoomsController public function join($id){ return $id; } Then I want to pass variable to it and it says MethodNotAllowedHttpException And my Form looks like this {{Form::open(['action'=> ['RoomsController@join', $room->id], 'method' => 'POST' ])}} {{Form::submit('Join', ['class' => 'btn btn-danger'])}} {{Form::close()}} Also have these routes Route::get('/','PagesController@index'); Route::get('/about', 'PagesController@about'); Route::get('

How to debug a spreadsheet custom function in google script?

回眸只為那壹抹淺笑 提交于 2019-12-23 15:37:09
问题 I am writing a custom function to be used in a spreadsheet and I would like to be able to at least display some data. Few things seem to work, for example Browser.msgBox doesn't find the appropriate permissions. Breakpoints don't interrupt execution. I had some hope for this code function test() { var s = "test" Logger.log(s) return s + s } But when I set a cell in the spreadsheet to "=test()" the cell properly shows the value "testtest" but when I return to the script editor and use view

How do I get the value from an adjacent cell using Google Script in a Google Spreadsheet?

落爺英雄遲暮 提交于 2019-12-23 08:03:27
问题 I apologise if this has been asked before but I've looked for an example and unfortunately I'm unable to find an answer hence why I'm asking here. If I have a custom function in a Google Spreadsheet how do I get the value of a cell if the contents are dynamically generated. I can get the value when it's a fixed value but not when it's dynamic. 回答1: Here's an example of getting the adjacent cell's value whether it's dynamic (created with a function or it's a flat value) function

Using a Custom Function in a Google Spreadsheet?

人走茶凉 提交于 2019-12-22 13:10:51
问题 I'm trying to figure out how I can write and run a custom function in a Google spreadsheet and I've been following this google tutorial. However at the time of this posting, I fear that this tutorial is out of date. I followed the steps, but see no way to access my in2mm function from within the spreadsheet that I started at. The tutorial suggests the following to make it show up You can manually start the scan by going to Tools > Script Manager... and clicking the Reload button. However, no