5

I'm using Firebase as it seems to be the simplest database solution for Android. I'm just playing around with it to get a bit of a feel for it. The biggest thing confusing me right now though is how (if possible) you could represent the database in some form of table like in excel. I know Firebase exports in JSON which isn't exactly designed to be displayed like that, but surely there is some system to be able to do it? Or would I have to write my own program that produces a CSV file?

For the sake of an example, I whipped up an application to record trip info for a taxi type service. It records the fares name, destination and the cost of the trip. Here's an example of the JSON.

{
  "Jobs" : {
    "job0" : {
      "Cost" : "$30",
      "Destination" : "Demo Dest 1",
      "Name" : "Demo Name 1"
    },
    "job1" : {
      "Cost" : "$40",
      "Destination" : "Demo Dest 2",
      "Name" : "Demo Name 2"
    }
  },
  "job number" : 2
}

Now say I want to produce a spreed sheet of just the job info. It would have column headers of "Name", "Destination" and "Cost" and it would list the corresponding information in each.

Would something like this be possible or is it just wishful thinking? If not, is there an online table based database tool you'd recommend for Android that is also easy?

Thanks in advance, I really appreciate it.

yennsarah
  • 5,467
  • 2
  • 27
  • 48
jontycg
  • 327
  • 2
  • 16
  • Do you want to create a `.xlsx` (or a similiar format) in android or do you want to create/view it in your browser, or on your pc? If you want to show a List of your items in Android, you can create a `RecyclerView` and a `List` of your objects. (Which would simplify your question to "How do I create a List with several columns in Android?"..) – yennsarah Jul 18 '16 at 09:43
  • Sorry I wasn't very clear. I was meaning to view it on a PC, preferably in some sort of spreadsheet software like excel. I was just wondering if there was any easy way to format it as a table or if I was going to have to make something myself to do it. – jontycg Jul 18 '16 at 09:52
  • Then this question is of topic - because you are asking for an off-site resource. You can search for programs like this in your favourite search engine. Furthermore, please take some time to read the help page, especially the sections named ["What topics can I ask about here?"](http://stackoverflow.com/help/on-topic) and ["What types of questions should I avoid asking?"](http://stackoverflow.com/help/dont-ask). And more importantly, please read [the Stack Overflow question checklist](http://meta.stackexchange.com/q/156810/204922). – yennsarah Jul 18 '16 at 09:58
  • I was more asking if this was possible to do with JSON and if there was a method for doing so. I wasn't so much looking for an off site tool to do it for me or a resource, more just a method of doing so or if there was a way that I could format my Firebase to better suit viewing as a table. I've searched extensively online and so I decided to ask if anyone else had any experience with converting JSON (or specifically JSON from Firebase) into a table format. – jontycg Jul 18 '16 at 10:04
  • If you have the `json` it is possible for sure..? Why should it not be possible? – yennsarah Jul 18 '16 at 10:12
  • The way I could see doing it would be to write an application to manually strip out the parts of the tree I don't want (everything except for the jobs) and then iterate through each job, remove the key and brackets and add the contents of it to as CSV file or something to that effect. It just seems like such a cumbersome way and so I thought there could possibly be a better way of doing it. – jontycg Jul 18 '16 at 10:18
  • Without even knowing the programming language you want to use, what do you expect as an answer? – yennsarah Jul 18 '16 at 10:25
  • I'm not asking for code on how to make an application that does what I said earlier. I know how to do that. It just seems like a horrible way of doing it. For an answer, I was expecting either someone to say "Yes that is the only way to do something like that as JSON trees aren't really meant to be viewed as tables" or for someone to describe how they would approach the problem differently. – jontycg Jul 18 '16 at 10:33
  • So, as an answer: Of course you can show the data in a table. In some programming languages `json` to `whatever-you-want(.class)` converters already exist and you can use them or write your own. You'll have to iterate through your `job` objects. Firebase also offers [Third Party Wrappers](https://www.firebase.com/docs/rest/third-party.html). For you next question, please only use **relevant** Tags - `Android` does not apply in this case. – yennsarah Jul 18 '16 at 11:28
  • Thanks a lot for the answer I really appreciate it. – jontycg Jul 18 '16 at 11:36

2 Answers2

4

I just recently had the same issue. I have data in firebase, that I want in excel. Tried numerous online converters before I found one that worked for me. Here is what i found : https://json-csv.com That seemed to work perfectly with my data.

Viper827
  • 194
  • 1
  • 13
1

If you want to automate Firebase to Excel Online or Google Sheets (every 10 minutes or hourly, etc.), use Flatly with instructions here. Saves you the manual work of conversion. Disclosure: I work at Flatly.