# Pull data from a large source

**URL:** https://community.glideapps.com/t/pull-data-from-a-large-source/35590
**Category:** Ask for Help
**Created:** [December 6, 2021, 8:02pm UTC](https://community.glideapps.com/t/pull-data-from-a-large-source/35590 "2021-12-06T20:02:17Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![Amal](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/amal/32/15421_2.png) [@Amal](https://community.glideapps.com/u/Amal)
#### Post date: [December 6, 2021, 8:02pm UTC](https://community.glideapps.com/t/pull-data-from-a-large-source/35590/1 "2021-12-06T20:02:17Z")

</div>

I have a database on google sheets of around 100,000 record lines. Is there a way for me to do a search on them without brining them into glide? **note: my app is completely based on glide sheets.**

So i need to do some sort of api call

---

<div class="post-metadata">

### Author: ![SantiagoPerez](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/santiagoperez/32/16807_2.png) [@SantiagoPerez](https://community.glideapps.com/u/SantiagoPerez)
#### Post date: [December 6, 2021, 8:34pm UTC](https://community.glideapps.com/t/pull-data-from-a-large-source/35590/2 "2021-12-06T20:34:08Z")

</div>

Hola @Amal

Take a look at this [thread](https://community.glideapps.com/t/nocodeapi-fetch/33318).

---

<div class="post-metadata">

### Author: ![Drearystate](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/drearystate/32/49605_2.png) [@Drearystate](https://community.glideapps.com/u/Drearystate)
#### Post date: [December 6, 2021, 8:56pm UTC](https://community.glideapps.com/t/pull-data-from-a-large-source/35590/3 "2021-12-06T20:56:50Z")

</div>

You can use a lookup formula if you don’t want to pay. The workbook that has the data you need you just have it equal the data you need to lookup and run the lookup on that workbook and the sheet you need the data returned to equals the cells with the results. Quite simple actually.

---

<div class="post-metadata">

### Author: ![Amal](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/amal/32/15421_2.png) [@Amal](https://community.glideapps.com/u/Amal)
#### Post date: [December 6, 2021, 9:03pm UTC](https://community.glideapps.com/t/pull-data-from-a-large-source/35590/4 "2021-12-06T21:03:38Z")

</div>

hi thanks for your reply. my glide app has no connection with googlesheets, it operated directly on glide tables. I need a use a API to lookup googlesheet database and pull the results into glide. I have no idea how to use sheets API inside glide

---

<div class="post-metadata">

### Author: ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)
#### Post date: [December 7, 2021, 12:15am UTC](https://community.glideapps.com/t/pull-data-from-a-large-source/35590/5 "2021-12-07T00:15:02Z")

</div>

Hola!

How long would you like to wait for an API answer using your GS with 100k rows: 2, 5, 8 or 10 sec?

GS is not a real database and has its limitation to find a value (row) quickly no matter your data has a kind of order or not. There are some tricks to improve the API answer but all depends on your needs and happiness: if you are happy with 10-12 sec, no problem… you can take this way/option 😀.

Saludos @Amal

---

<div class="post-metadata">

### Author: ![Amal](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/amal/32/15421_2.png) [@Amal](https://community.glideapps.com/u/Amal)
#### Post date: [December 7, 2021, 4:13am UTC](https://community.glideapps.com/t/pull-data-from-a-large-source/35590/6 "2021-12-07T04:13:19Z")

</div>

Thanks for replying back. I dont mind waiting 10 sec for the data to come back. Can you please let me know how i can do this? im new to api with glide

---

<div class="post-metadata">

### Author: ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)
#### Post date: [December 7, 2021, 4:48am UTC](https://community.glideapps.com/t/pull-data-from-a-large-source/35590/7 "2021-12-07T04:48:39Z")

</div>

check this one out:

> [@English Dictionary with 163,819 rows!](https://community.glideapps.com/t/english-dictionary-with-163-819-rows/28645):
>
> this is example how to use big numbers of rows in free or paid App… enjoy! (in this app i’m using 163,819 rows but i can easy add up to 2 millions) [[Screen Shot 2021-07-03 at 12.04.07 AM]](https://english-dictionary.glideapp.io/)

---

<div class="post-metadata">

### Author: ![ShantanuIyengar](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/shantanuiyengar/32/35546_2.png) [@ShantanuIyengar](https://community.glideapps.com/u/ShantanuIyengar)
#### Post date: [December 7, 2021, 12:47pm UTC](https://community.glideapps.com/t/pull-data-from-a-large-source/35590/8 "2021-12-07T12:47:46Z")

</div>

So there’s a work around I built quite some time back.

1. Create a table.
2. Add 10 blank rows in it.
3. Add a single value column that brings in your searched value here.
4. Add a coloumn for rowNo.
5. Do your api call and limit the results to 10 rows.
6. For each row get a json depending on rowNo.
7. In another coloumn parse the json.

---

<div class="post-metadata">

### Author: ![Amal](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/amal/32/15421_2.png) [@Amal](https://community.glideapps.com/u/Amal)
#### Post date: [December 7, 2021, 2:49pm UTC](https://community.glideapps.com/t/pull-data-from-a-large-source/35590/9 "2021-12-07T14:49:19Z")

</div>

This sounds good. I just need to know how to use API for GSheets. any steps i can follow along with?

---

<div class="post-metadata">

### Author: ![ShantanuIyengar](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/shantanuiyengar/32/35546_2.png) [@ShantanuIyengar](https://community.glideapps.com/u/ShantanuIyengar)
#### Post date: [December 7, 2021, 3:11pm UTC](https://community.glideapps.com/t/pull-data-from-a-large-source/35590/10 "2021-12-07T15:11:19Z")

</div>

Hey @Amal  
So a short process on how to use API calls.  
In your google sheet, go to tools → App Script or Extension → Appscript.  
So the page that opens up is the a code block where you can write typescript/javascript code.  
The following script is already linked to your google sheet.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/3/b3817386a62689f1009842bbe59ba0ea5d182f50.png)

So you have to create a function as myFunction to fetch details from an API.

A basic code would be:

> var url = “”;  
> var options = {  
> “method”: “post”, `// method of api call (get or post)`  
> “headers”: { `// headers to be added (majorly used is Authorization)`  
> “Authorization” : “”  
> },  
> “payload”: “”, `// any type of data you want to send to the api-call can be sent using payload`  
> “muteHttpExceptions”:true ` // this is used so you get the entire success/error response when you make the call`  
> };  
> var response = UrlFetchApp.fetch(url,options);

You response is now available in the `response` variable which you can use.

To parse the response in JSON, use the code below.

> var json\_response = JSON.parse(response.getContentText());

If you need any specific help regarding your api call,  
you can contact me at [shantanu@modernizing-spaces.com](mailto:shantanu@modernizing-spaces.com)

---

<div class="post-metadata">

### Author: ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)
#### Post date: [December 7, 2021, 3:26pm UTC](https://community.glideapps.com/t/pull-data-from-a-large-source/35590/11 "2021-12-07T15:26:09Z")

</div>

Hola de nuevo @Amal

I have a demo APP for what you want. I turned a GS into a REST API and works fine so far, with 45k rows and 8 columns the API calls reply around 4-6 secs.

Let me find some free time to make some modifications to my APP (e.g. translate it to english) to help you when you test it.

There are many web sites where you can see how to develop this kind of things, one better than other (or worse), take this as example:

> **[Turn a Google Sheet into a REST API](https://ravgeetdhillon.medium.com/turn-a-google-sheet-into-a-rest-api-b08f3fd641ad)**
>
> Turn your Google Sheet into a REST API and access it in any application.

I will be back soon!

Saludos

---

<div class="post-metadata">

### Author: ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)
#### Post date: [December 7, 2021, 3:47pm UTC](https://community.glideapps.com/t/pull-data-from-a-large-source/35590/12 "2021-12-07T15:47:34Z")

</div>

👋 Interested in learning as well.

+1 for English translation 🕶

Thanks in advance.

---

<div class="post-metadata">

### Author: ![Amal](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/amal/32/15421_2.png) [@Amal](https://community.glideapps.com/u/Amal)
#### Post date: [December 7, 2021, 4:52pm UTC](https://community.glideapps.com/t/pull-data-from-a-large-source/35590/13 "2021-12-07T16:52:36Z")

</div>

Thank you so much, looking forward to a English tutorial !

---

<div class="post-metadata">

### Author: ![Amal](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/amal/32/15421_2.png) [@Amal](https://community.glideapps.com/u/Amal)
#### Post date: [December 7, 2021, 8:25pm UTC](https://community.glideapps.com/t/pull-data-from-a-large-source/35590/14 "2021-12-07T20:25:44Z")

</div>

ok so i managed to use follow a tutorial and write my own appscript, and i was able to pull the data into glide column, but it takes like 20 secs ☹ . . I also need to format it, but have no idea how to, below is the result it returns on searching with a Avatar number : 29796

{“data”:[[29796,104.338397839434,8,“Olive Oxford with Pocket”,“Buzz Cut”,“Stud Earring”,“Lunchbox”,“Dark Brown”,"",“White”,"",“Tan Workers Cap”,"",“White Leather Sneaker with Grey Sole”,“Charcoal Slacks”]],“error”:false}

As you see the headers are missing for some reason :\

---

<div class="post-metadata">

### Author: ![ShantanuIyengar](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/shantanuiyengar/32/35546_2.png) [@ShantanuIyengar](https://community.glideapps.com/u/ShantanuIyengar)
#### Post date: [December 8, 2021, 6:23pm UTC](https://community.glideapps.com/t/pull-data-from-a-large-source/35590/15 "2021-12-08T18:23:00Z")

</div>

What headers! Its a JSON response! What are you looking for?

---

<div class="post-metadata">

### Author: ![Amal](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/amal/32/15421_2.png) [@Amal](https://community.glideapps.com/u/Amal)
#### Post date: [December 8, 2021, 8:59pm UTC](https://community.glideapps.com/t/pull-data-from-a-large-source/35590/16 "2021-12-08T20:59:36Z")

</div>

how do i format it so its presentable

---

<div class="post-metadata">

### Author: ![ShantanuIyengar](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/shantanuiyengar/32/35546_2.png) [@ShantanuIyengar](https://community.glideapps.com/u/ShantanuIyengar)
#### Post date: [December 9, 2021, 9:43am UTC](https://community.glideapps.com/t/pull-data-from-a-large-source/35590/17 "2021-12-09T09:43:06Z")

</div>

I may not be the right guy!  
But the process i can think of is this:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/8/08077290a806dae2ba36509ab5bb91e2942f524e.png)  
I added the your JSON data in the first column

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/c/ecb0838a0bad487e150e5e0aa1acde36a2ee4eef.png)

> const data = String(p1);  
> const text = data.substring(10);  
> return text;

Used the code above to remove the first part of the string.  
As the data can be of dynamic length, used this to eliminate the last part of the string

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/7/a7d9d1da0c55620cdc5d3e67832e0823158c5b16.png)

and finally did a split text to get all values in individual fields

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/3/e3d7801d4b848c2f91d62c80a16699e49454c2e4.png)

So now if i want the first parameter

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/1/6103e85bca86dd5fcd0bb22b8f484aa631c09048.png)

All parameters in array start at 0!

This is on assumption that your api always sends the same number of data , seprated.
