# GESI - advanced usage

**URL:** <https://forums.eveonline.com/t/gesi-advanced-usage/328776>\
**Category:** Third Party Developers\
**Created:** [September 19, 2021, 7:42am UTC](https://forums.eveonline.com/t/gesi-advanced-usage/328776 "2021-09-19T07:42:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gradinger](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/gradinger/32/283951_2.png) [@Gradinger](https://forums.eveonline.com/u/Gradinger)\
**Post date:** [September 19, 2021, 7:42am UTC](https://forums.eveonline.com/t/gesi-advanced-usage/328776/1 "2021-09-19T07:42:00Z")

</div>

again more questions arise 🙂

i have made a little google-script with GESI to update transactions

now it does work quite well but i did reach my urlfetch-limit pretty fast  
my guess is, the way i wrote the script, it does invoke a client-call with every loop  
but i’m not sure if it does, and i have no idea how to avoid it

thanks for any help  
grad

* * *

the important part of the script

function updateTrans() {  
var client = GESI.getClient().setFunction(‘corporations\_corporation\_wallets\_division\_transactions’);  
var type\_data = client.execute({division: 6});

…

for (var i=data\_length-1; i\>-1; i–) {  
new\_id = type\_data[i][6];  
if (new\_id\>last\_id) {  
trans\_sheet.insertRowAfter(1);  
for (var j=0; j\<data\_width; j++) {  
trans\_sheet.getRange(2,1+j,1,1).setValue(type\_data[i][j]);  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![Blacksmoke16](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/blacksmoke16/32/376589_2.png) [@Blacksmoke16](https://forums.eveonline.com/u/Blacksmoke16)\
**Post date:** [September 19, 2021, 2:40pm UTC](https://forums.eveonline.com/t/gesi-advanced-usage/328776/2 "2021-09-19T14:40:03Z")

</div>

As it stands, this code only makes 1 request to ESI when it first starts. The real questions is how often are you invoking it?

---

<div class="post-metadata">

**Author:** ![Gradinger](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/gradinger/32/283951_2.png) [@Gradinger](https://forums.eveonline.com/u/Gradinger)\
**Post date:** [September 19, 2021, 2:58pm UTC](https://forums.eveonline.com/t/gesi-advanced-usage/328776/3 "2021-09-19T14:58:52Z")

</div>

hmmm, thanks

well, i start the script once through a UI-Item

not sure, why i got the urlfetch error then

i also get lots of timeout-errors - at least sometimes - with my GESI-requests in the table cells - probably because they are now several hundred - that’s why i’m working on invoking everything through script to have more control over it  
maybe google updated my GESI-calls in the cells to often… no idea

---

<div class="post-metadata">

**Author:** ![Blacksmoke16](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/blacksmoke16/32/376589_2.png) [@Blacksmoke16](https://forums.eveonline.com/u/Blacksmoke16)\
**Post date:** [September 19, 2021, 3:42pm UTC](https://forums.eveonline.com/t/gesi-advanced-usage/328776/4 "2021-09-19T15:42:08Z")

</div>

What functions are you using? It’s possible you’re making _a lot_ more requests than you think.

---

<div class="post-metadata">

**Author:** ![Gradinger](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/gradinger/32/283951_2.png) [@Gradinger](https://forums.eveonline.com/u/Gradinger)\
**Post date:** [September 19, 2021, 3:55pm UTC](https://forums.eveonline.com/t/gesi-advanced-usage/328776/5 "2021-09-19T15:55:44Z")

</div>

in the script i just use the one above

in the cells i use things like this:  
QUERY(markets\_region\_history(A5; $B$1; FALSE); “Select avg(Col5), avg(Col6) LABEL avg(Col5) ‘’, avg(Col6) ‘’”; FALSE)

ARRAY\_CONSTRAIN(QUERY(markets\_region\_history(A5; $B$1; FALSE); “Select Col5, Col6”; FALSE); 1; 2)

QUERY(markets\_region\_orders($B$1; “sell”; A5); “select sum(Col11) WHERE Col4=60003760 LABEL sum(Col11) ‘’”; 0)

that’s 3 per item, around 100 items

there are a few more tabs, but nothing heavy - i think

---

<div class="post-metadata">

**Author:** ![Blacksmoke16](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/blacksmoke16/32/376589_2.png) [@Blacksmoke16](https://forums.eveonline.com/u/Blacksmoke16)\
**Post date:** [September 19, 2021, 4:02pm UTC](https://forums.eveonline.com/t/gesi-advanced-usage/328776/6 "2021-09-19T16:02:44Z")

</div>

To be clear if you’re fetching orders for a single item from jita that’s going to be more than 1 request as each page is its own request. You would be better off fetching _all_ the data and filtering it down. I.e. load in market history data in a dedicated sheet, then vlookup what you need in other cells, versus using the function with the cell itself.

It would also be more efficient if you used a custom function to fetch price data. I.e. fetch the entire market, keep track of the specific orders you want and output it to a dedicated sheet, then again, vlookup what you need from there.

---

<div class="post-metadata">

**Author:** ![Gradinger](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/gradinger/32/283951_2.png) [@Gradinger](https://forums.eveonline.com/u/Gradinger)\
**Post date:** [September 20, 2021, 11:54am UTC](https://forums.eveonline.com/t/gesi-advanced-usage/328776/7 "2021-09-20T11:54:58Z")

</div>

ok thanks

i know what you mean in general (and i do use data tables with lookups already at some points) - just have to check what that means in detail in this case

i may come back with more questions 🙂

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/eveonline/original/3X/4/1/41ec4921cbaca7a6f9ea556e7cc20018461eae5e.png) [@system](https://forums.eveonline.com/u/system)\
**Post date:** [December 19, 2021, 11:55am UTC](https://forums.eveonline.com/t/gesi-advanced-usage/328776/8 "2021-12-19T11:55:29Z")

</div>

Closed on December 19, 2021, 11:55am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
