Create Triggered Reporting in App

Hi All,

Does anybody know if it is possible to create reports through Thunkable. I store data in firebase, I would like the user to be able to press a button in the app and it creates a csv/pdf file of the data aligned with their User ID and sends that to their email address? Happy to use other software or an API to do it if anybody knows of any?

Thanks!

Hi Jacob,

The csv format is very simple. You can create it yourself.

First, get all data from Firebase and then combine them into a string using the “,” symbol and send it by email using the Share block. If you wish, you can separate the data fields with a tab, and the lines with a newline.

Hi Actech - Would this not just send the data in the body of the email? Or would it create the csv file and attach?

I am talking about a method without using a web server. In this case, it will be possible to send the data in the body of the letter as a message.

If you need a file, then you need a web-server. The data is sent to it, it creates the file and send a letter as an attachment.

CSV format:

name1,address1,age1,note1
name2,address2,age2,note2

1 Like

Still searching for a good alternative here,

Does anyone have any experience with Firebase Cloud Functions or an API that could convert JSON to CSV… my end goal is to pull information from firebase then send an email to the users address with a CSV or PDF attachment of their reporting when they click “Generate” in the app

Any ideas?

Will the JSON structure change or does it have the same structure?

Do you have an example of a JSON structure so that it can be viewed?

Hi Alex,

Yes the JSON structure will remain the same, example below:

image

The only variable part bar the child node values is the time stamp parent node i.e 2019112105

Check it

https://x.thunkable.com/projects/5ddf7ba73cc8a1e17c06046c/project/properties/designer/

Thanks Alex - but I need it to create the CSV file and then send to the user… any thoughts?

Thunkable X does not support file saving, but you can send CSV data via email or messenger.

If you need a file, you need to look for an API service that allows you to transfer text to it, and it will make them an file and send it by mail, or write a server script for this yourself.

Thanks Alex,

If anyone is further interested in this, I have figured out a way to do this as below:

1 - Pull the JSON data back from Firebase
2 - Turn that data into HTML using blocks
3 - Use restpack.io API to convert this HTML to PDF
4 - Use sendgrids API to send this link to the user

Works quite well, Sendgrid is has free use for 100 emails a day, and restpack.io is a about $9 usd a month but is seemless.

2 Likes