パッケージ、リポジトリ、アプリカテゴリを検索

GitHub リポジトリanwarsafy/firebase_excel_export

firebase_excel_export

anwarsafy/firebase_excel_export open-source repository details.

firebase_excel_export のプロジェクト画像
スター
0
フォーク
0
最終プッシュ(UTC)
2024/12/30
プロジェクト状態
公開中

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

Firebase Excel Export

A Flutter package to export Firestore collections to Excel with a simple and customizable approach. Perfect for Flutter web applications!

Features

  • Export Firestore data directly to .xlsx files.
  • Fully customizable headers and data mapping.
  • Easy integration with Firestore.
  • Designed for Flutter web applications with seamless file download functionality.

Installation

Add the package to your pubspec.yaml file:

dependencies:
  firebase_excel_export: ^0.0.1

Run the following command to fetch the package:

flutter pub get

Usage

Basic Example
import 'package:firebase_excel_export/firebase_excel_export.dart';

Future<void> exportUsers() async {
  await FirebaseExcelExporter.exportToExcel(
    collectionName: 'users',
    headers: ['Email', 'Name', 'Phone Number'], // Customize your headers
    mapper: (data) => [
      data['email'],       // Map Firestore fields to the headers
      data['name'],
      data['phoneNumber'],
    ],
    fileName: 'users_export.xlsx', // Optional: Customize file name
  );
}
Parameters
  • collectionName (required): The Firestore collection to export.
  • headers (required): A list of custom headers for the Excel file.
  • mapper (required): A function to map Firestore document fields to header columns.
  • fileName (optional): The desired file name for the Excel file (default: export.xlsx).
Advanced Example with Query Filtering
Future<void> exportFilteredUsers() async {
  await FirebaseExcelExporter.exportToExcel(
    collectionName: 'users',
    headers: ['Email', 'Name', 'Status'], // Define custom headers
    mapper: (data) => [
      data['email'],       // Map data fields dynamically
      data['name'],
      data['status'],
    ],
    queryBuilder: (query) => query.where('status', isEqualTo: 'active'), // Apply Firestore query
    fileName: 'active_users_export.xlsx', // Define a custom file name
  );
}

Key Features

  1. Dynamic Headers: Define custom headers tailored to your Firestore data.
  2. Data Mapping: Map fields dynamically to headers for total flexibility.
  3. Web-Optimized: Built for Flutter web to enable seamless downloads.

Compatibility

This package is designed for Flutter web and depends on:

  • cloud_firestore
  • firebase_core
  • excel
  • universal_html

Ensure these dependencies are added to your pubspec.yaml.

Support

If you encounter any issues or have feature requests, feel free to open an issue on the GitHub repository.

License

This package is licensed under the MIT License. See the LICENSE file for more details.

Anwar Safy GitHub avatar
GitHub 作者

Anwar Safy ↗

Passionate Flutter coder, building the future of mobile

@Alo-Information-TechnologySaudi Arabia
言語Dart

このリポジトリが公開するパッケージ

使用している依存関係

依存関係一覧 9 件

プロジェクトに合うリポジトリを選ぶには?

用途で絞り込み、開発状況を比較し、採用前に元のリポジトリで要件を確認しましょう。

  1. 名前・作者・説明で検索し、技術トピックで絞り込みます。
  2. スター、フォーク、最近のプッシュを比較します。スターは関心の目安であり、品質の保証ではありません。
  3. 利用前に GitHub で README、ライセンス、Issues を確認します。

情報源と管理

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗