# Import data from Firebase to Glide

**URL:** https://community.glideapps.com/t/import-data-from-firebase-to-glide/26230
**Category:** Community Resources
**Created:** [April 30, 2021, 5:14pm UTC](https://community.glideapps.com/t/import-data-from-firebase-to-glide/26230 "2021-04-30T17:14:11Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Zancoper](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/zancoper/32/10615_2.png) [@Zancoper](https://community.glideapps.com/u/Zancoper)
#### Post date: [April 30, 2021, 5:14pm UTC](https://community.glideapps.com/t/import-data-from-firebase-to-glide/26230/1 "2021-04-30T17:14:11Z")

</div>

Hello everyone, everything good?  
For those who need to import data from Firebase into the spreadsheet in Glide, I am providing a Script that you can edit according to your need.  
I hope they help!

Good studies!

* * *

url=“Your Firebase bank URL.json?auth=API KEY”  
xpath =“NAME DATABASE”

function addProduct() {  
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(“TAB NAME”);  
sheet.appendRow([IMPORTJSON()]);  
}  
function IMPORTJSON(){  
try{  
var res = UrlFetchApp.fetch(url);  
var content = res.getContentText();  
var json = JSON.parse(content);  
var patharray = xpath.split(“/”);

```
for (var i=0;i<patharray.length;i++){
  json = json[patharray[i]];

  }

if(typeof(json) === "undefined"){
  return "Node Not Availabe";
} else if(typeof(json) === "object"){
  var tempArr = [];

  for(var obj in json){
    tempArr.push([obj.json[obj]]);
  }
  return tempArr;
} else if(typeof(json) !== "object") {
  return json;
}

```

}  
catch(err){  
return “Error getting data”;  
}  
}

* * *

This script connects to your Firebase Database and collects the information by saving it in the spreadsheet in the first column that was defined in this case.

See you later.

---

<div class="post-metadata">

### Author: ![AymenM](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/aymenm/32/21370_2.png) [@AymenM](https://community.glideapps.com/u/AymenM)
#### Post date: [April 30, 2021, 6:02pm UTC](https://community.glideapps.com/t/import-data-from-firebase-to-glide/26230/2 "2021-04-30T18:02:39Z")

</div>

Super !
