Using a google script to calculate information in a spreadsheet

I am using a script in google sheets to calculate the distance between start and stop points. I can call this function by using a formula in my spreadsheet .

=GMfunc(a2,a3,“miles”)

Works great when I put the formula to call the function in my cells manually.

Doing it this way, the script runs on every cell, every time I open up the file - which eats through my 1000 API call limit in about 2.3 seconds.

image

Any ideas on how to have the script be called automatically through APPSHEET when the record is created, and then put only values in the distance column rather than the function formula - to stop eating my API calls on document open?

Point me in the right direction, please - I don’t expect you to do my work for me. I can’t afford to put you on my payroll.

Search in this community with some keywords like this:

https://community.appsheet.com/search?q=%23ask%20script%20onchange

Using the onChange(e) trigger is the key to getting the scripts to run when data is updated by Appsheet.

2 Likes