Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zeyadkhaled/firebase-query-to-excel
A Java class to process Firebase Firestore database queries and create an excel file that could be shared.
https://github.com/zeyadkhaled/firebase-query-to-excel
csv database excel firebase firebase-database firebase-realtime-database firestore java library query sharing
Last synced: 27 days ago
JSON representation
A Java class to process Firebase Firestore database queries and create an excel file that could be shared.
- Host: GitHub
- URL: https://github.com/zeyadkhaled/firebase-query-to-excel
- Owner: zeyadkhaled
- Created: 2018-07-20T07:22:52.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-03T21:19:55.000Z (over 5 years ago)
- Last Synced: 2024-10-27T18:40:51.442Z (3 months ago)
- Topics: csv, database, excel, firebase, firebase-database, firebase-realtime-database, firestore, java, library, query, sharing
- Language: Java
- Homepage:
- Size: 2.93 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Firebase-Query-to-Excel
A class to process Firebase Firestore database queries and create an excel file that could be shared## Usage
1. Add above class to your project
2. Import necessary libraries
3. To use the class in another class or activity create an instance of it-fieldNames String array contains the name of the fields you want to retrieve from the query. Order of names in the array is important.
```java
String[] fieldNames = {"name", "email", "id", "more"};
FirebaseDBCollectionToExcel createExcel = new FirebaseDBCollectionToExcel( fieldNames);
```
4. Within the part you call the query include the buildFileFromQuery(QueryDocumentSnapshot document ) method like so:
```java
db.collection("users").get().addOnCompleteListener(new OnCompleteListener() {public void onComplete(@NonNull Task task) {
if (task.isSuccessful()) {
for ( QueryDocumentSnapshot document : task.getResult()) { //Include here
createExcel.buildFileFromQuery(document);
}
}
}
}
```
5. After creating the file, you can save it to the local storage using saveFileToStorage(String fileName, String dirName) method:
```java
String fileName = "File Name";
String dirName = "Directory Name";
createExcel.saveFileToStorage(fileName, dirName);
```
6. Lastly given the file is in storage, you can share it through mailing applications using the method shareFileToEmail( String subject)
This method will open an intent
```java
String subject = "Email Subject";
createExcel.shareToEmail( subject);
```## Needed improvments
- Create a ready to use importable library## Authors
[Zeyad Khaled](https://www.linkedin.com/in/zeyadkhaled/ "Zeyad Khaled")