androidfirebasefluttergoogle-cloud-firestore

How to import bulk data in firebase firestore database from excel or google spreadsheet or CSV using flutter


I have flutter app where User fill a long form. but I want to add another button where when user want click and upload 'excel or spreadsheet or CSV' having same data as form and this data store in firebase firestore. please help me to overcome this problem.


Solution

  • There's no API for doing that, Firestore doesn't have an option in which you can upload an Excel or a CSV file and convert the data automatically to Firestore. To solve this, you should write some code for that. As also Krish Bhanushali suggested in his comment, you need to read the file, line by line, save that data into an object of a custom class, and then write all the data to Firestore. This means that each line you read will be added in Firestore as a document.