Unexpected updates occurring in custom Google Sheet functions

Currently, I am utilizing a personalized function to retrieve price data for EVE Online. However, I am encountering an issue where the function is updating every 10-20 minutes, leading to a depletion of my daily URL Fetches quota.

The primary function can be found in a page titled "Warehouse Stock", pulling price data for items listed in the "Item" column. The cell refreshes due to a custom function altering cell B4 in the utility sheet. Whenever this cell undergoes a change, the values in the custom function are updated through an IF/THEN statement. Finally, the prices are loaded into the main sheet and sorted according to the "product" column.

I have disabled recalculation on change and turned off iterative calculation as well.

Below is the custom function:

    /**
* Query's Fuzz market API for the given types
* @param {range} A vertical range of type_ids.
* @return maxBuy and minSell for each type_id
* @customfunction
*/
function fuzzApiPriceData(type_ids) {
  if (!type_ids) throw 'type_ids is required';
  const ids = Array.isArray(type_ids) ? type_ids.map(id => id[0]) : [type_ids];
  const fuzz_price_data = JSON.parse(UrlFetchApp.fetch(`https://market.fuzzwork.co.uk/aggregates/?station=60008494&types=${ids.join(',')}`));
  return [['minSell', 'maxBuy']].concat(type_ids.map(type_id => [parseFloat(fuzz_price_data[type_id]['sell']['min']), parseFloat(fuzz_price_data[type_id]['buy']['max'])]));
}

https://i.sstatic.net/ZZR3k.png

https://i.sstatic.net/f0Sgr.png

https://i.sstatic.net/AMJVd.png

https://i.sstatic.net/Vkvf8.png

Answer №1

There seems to be a misunderstanding at play here.

"Custom functions" are meant to be written within cells on a sheet, as they are designed to constantly update and run all the time.

If you are trying to execute a custom script, you should do so from the script editor itself, rather than writing the function in a cell at ALL.

It appears that you may not have written the "custom function" you are using(?). As such, it might be challenging (but not impossible!) to convert it into a script that can write to specific locations on the sheet at specified times. Perhaps a bit more research on the distinction between custom functions intended for cells and scripts meant to be triggered by time would be beneficial.

Answer №2

After reviewing your response:

I am looking for a way to automatically refresh the function daily, while also having the option to manually trigger the function based on the contents of cell Utility!B4.

I suggest utilizing Installable Triggers:

  1. Time-driven trigger: This trigger can run a function daily at a specific time.
  2. Installable edit trigger: It can execute a function when a specified value in a particular cell changes.

If you prefer manual execution of the function, consider adding a drawing and assigning a function to it.

For more information, refer to:

Answer №3

If you're looking for a creative solution, one approach is to place a checkbox in a cell and then modify your custom function to include an additional reference to that specific cell. By toggling the checkbox on and off, you can trigger the activation of your custom function. Additionally, you can create another function with a trigger that changes the true/false value as needed. For example, in sheet 'Data' cell A3, you can use the function getDataJSON(C1,A2:U2,A1), even though the function typically only considers the first and second parameters. Check out this link for more details: https://docs.google.com/spreadsheets/d/1DN0Gfim0LC098zVgrUpt2crPWUn4pWfZnCpuuL1ZiMs/edit?usp=sharing

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Passing a return value to ajax success within an Express application

I am trying to retrieve a value from an included file and use it in the success function of an ajax call within Express. Below is my code for app.js: var userdetail = { "useremail":req.body.useremail, "fname" : req.body.fname, "lname" : req.bo ...

What is the best way to activate the li tag based on the information in a json data loop?

https://i.sstatic.net/iXqyU.png I am currently working with a JSON file that contains page titles and content data. Here is an example of the JSON structure: [ { "title":"About", "content":"About me . . . . . . " }, { "title":"Contact", "c ...

Combining the inline JavaScript linting tool ESLint with the popular Airbnb configuration and Facebook

In my current project, I am utilizing ESLint and looking to incorporate Facebook flow. However, I am encountering warnings from ESLint regarding flow type annotations. Within the project root directory, I have both .flowconfig and .eslintrc files present. ...

Material Design Autocomplete search feature in Angular 2

I'm encountering some challenges with autocomplete in Angular2 Material Design. Here are the issues I'm facing: 1. When I type a character that matches what I'm searching for, it doesn't display in the autocomplete dropdown as shown in ...

Response from Vimeo's AJAX API

I am having trouble retrieving the AJAX response from Vimeo to extract a thumbnail without using JQuery. Even though I can see the response data in JSON format when I type the response query (http://vimeo.com/api/v2/video/30408418.json) into the browser an ...

Using Jquery $.ajax may lead to temporary freezing of the Browser

I have a $ajax function that fetches multiple JSON objects from a URL and converts them into divs. There are around 50 objects, and I am using setInterval to call the $ajax function every 10 seconds for updates on each of the created divs. However, I' ...

Enhance the progression bar using JavaScript

Is there a way to dynamically update a progress bar in HTML while a function is running? function fillProgressBar() { var totalIterations = 100; for (var i = 1; i <= totalIterations; i++) { //perform calculations progressBarWidth = (i/to ...

Having difficulty sending ajax to the controller function

Currently, I am facing an issue with updating my database using AJAX in Laravel. The goal is to change the value in the enable column from 1 to 0 when a toggle button is clicked. Below script is included in the view: $(".toggle-btn").change(function() { ...

Stop Ajax from activating jQuery function

Upon examining our Drupal site, we discovered a straightforward jQuery script that inserts a div class containing content: (function($) { Drupal.behaviors.myHelpText = { attach: function (context, settings) { //code begins //adjusting placeholder ...

Having trouble extracting JSON data from an API in a Flutter application

My goal is to retrieve and parse JSON data from a REST API in node.js using express and MongoDB, and then present it as userdata. However, no matter what I attempt, I am unable to successfully parse the data. It either throws an exception like "Unhandled E ...

Transform data into JSON format using the stringify method

I am facing an issue with my TypeScript code where I need to retrieve specific information from a response. Specifically, I want to output the values of internalCompanyCode and timestamp. The Problem: An error is occurring due to an implicit 'any&apo ...

Understanding the reasons behind 'undefined' res.body in Express

Why does the response body show as undefined in Express? How can I access the response body properly? Is something going wrong here? import {createProxyMiddleware} from 'http-proxy-middleware' import bodyParser from 'body-parser' impor ...

Transform the object into an array of JSON with specified keys

Here is a sample object: { labels: ["city A", "city B"], data: ["Abc", "Bcd"] }; I am looking to transform the above object into an array of JSON like this: [ { labels: "city A", data: "Abc" }, { labels: "city B", data: "Bcd" }, ]; ...

Struggling to access a remote URL through jQuery's getJSON function with jsonp, but encountering difficulties

Currently, I am attempting to utilize the NPPES API. All I need to do is send it a link like this and retrieve the results using jQuery. After my research, it seems that because it is cross-domain, I should use jsonp. However, I am facing difficulties m ...

Including a null:null entry in the json_encoded data

The following code was not written by me, and unfortunately I do not have the time to update the deprecated calls. <?php $mageFilename = 'app/Mage.php'; require_once $mageFilename; umask(0); Mage::app(); $db=mysql_connect('localhost&ap ...

converting a JSON object into an array

I'm facing a challenge and unsure how to proceed. I have received JSON data from an API: https://i.stack.imgur.com/GdDUo.png When I log the data, this is what appears in the console: https://i.stack.imgur.com/GjSPW.png My goal is to extract the id ...

Tips for handling spaces in JSON arrays when parsing data in Ansible

Here is the JSON data I am working with: { "changed": false, "invocation": { "module_args": { "cucm_ip": "1.1.1.1", "cucm_option": "DBREPLICATION", "cucm_pwd": "123", "cucm_user": "123" ...

Using an object method within a different object in JavaScript

I am attempting to create two objects, one from each of my classes - a Person object and a Drink object. I then want to invoke the drinking method by passing in a Drink object. However, I am struggling with how to do this. Here is my code, and I can't ...

What sets these async method declarations apart?

What goes on behind the scenes? const facade = { // A: doSomething: async () => await delegatedFunction(), // B: doSomething: async () => delegatedFunction(), // C: doSomething: () => delegatedFunction(), // D: do ...

Can D3 transform regions into drinking establishments?

I can create a graph using D3 areas, as shown in this example: https://i.sstatic.net/jaxJb.png Now, I want to add an animation to this graph. When the webpage loads, the initial figure will be displayed. Then, each area will morph into a bar chart. Addit ...