Search code examples
excelfluttergoogle-cloud-firestoreexport-to-excel

How can I export my Firebase data in Excel Sheet using app?


I am making a form app. Admin creates a form and then users can fill the form. Questions and answers are saved to Firebase Firestore. This is how my Firestore looks like. After users fill the form, I want to enable admin to download Excel file by pressing "Download" button. Excel file would contain picked form (I can access to form by formID) with all questions and answers of that form.

EDIT: If it's not possible to export in Excel, CSV would also be acceptable


Solution

  • Firebase doesn't provide a built-in option for this issue, you have to build this on your own by following these steps when the admin invokes the download button:

    1. Get the desired form data from Firestore.
    2. Use an excel package(excel/syncfusion_flutter_xlsio) to write the extracted data from the above step to an excel sheet.
    3. Use share package to give the admin the option to view, save and share the extracted excel file from the above step. (optional)