搜索插件、代码仓与 APP 分类

插件详情v0.0.8

firebase_excel_export

一个 Flutter 包,用于将 Firestore 集合导出为 Excel 文件,支持自定义标题和数据映射。

AndroidiOSmacOSWindows
近 30 天下载
57
喜欢数
6
Pub 分数
145

安装插件

flutter pub add firebase_excel_export

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个 Flutter 包,可将 Firestore 集合中的数据导出为 Excel 文件(XLSX、ODS),支持自定义标题和灵活的数据映射。它通过将结构化的 Firestore 文档转换为与常见办公工具兼容的电子表格格式,简化了数据共享和报告。该包可无缝集成到面向 Android、iOS、macOS 和 Windows 的 Flutter 应用中,非常适合需要离线数据导出或管理报告功能的应用程序。

适合场景

  • 将用户数据导出到Excel
  • 从 Firestore 集合生成报告
  • 创建可下载的分析表
  • 将应用数据与外部电子表格同步
  • 自动化业务工作流中的数据导出

主要特点

  • 可自定义的列标题
  • 灵活的数据字段映射
  • 支持 XLSX 和 ODS 格式
  • 跨平台兼容性
  • 与 Firestore 查询的简单集成

适合对象

  • 管理员仪表板
  • 数据迁移工具
  • 商业智能应用
  • Flutter 应用中的报告功能
  • 需要离线数据访问的团队

使用建议

  • 需要 Firebase Firestore 设置
  • 仅限文档级别导出
  • 与 Excel 文件无实时同步
  • 需要手动导出触发
  • 文件大小可能随着大数据集的增长而增大

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

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.

所属分类

依赖

源码仓库

使用此插件的项目

暂无相关数据。