Sheetifye

The Native Flutter Spreadsheet Engine β€” View, Edit, and Persist

Pub Version License Flutter Tests Issues


Sheetifye is a production-grade Flutter spreadsheet widget with native XLSX & CSV support, a live formula engine, full cell editing, undo/redo, clipboard, autofill, and a complete persistence lifecycle β€” all rendered directly on the Flutter canvas with no WebView or PlatformView.

Sheetifye β€” Native Flutter Spreadsheet Engine
Spreadsheet Editor on iOS
πŸ“± iOS
Excel Viewer on Android
πŸ€– Android
Flutter Spreadsheet on Web and Desktop
🌐 Web / Desktop

πŸ“– Docs  Β·  πŸ’‘ Example  Β·  πŸ“‹ Changelog  Β·  πŸ› Issues


✨ What's New in v1.1.0

Sheetifye has evolved from a viewer into a full spreadsheet editing platform:

  • πŸ–ŠοΈ Cell Editing β€” Inline editor overlay with formula support
  • πŸ’Ύ Persistence Lifecycle β€” onSave, onSaveAs, onBeforeClose, onDiscardChanges hooks
  • ↩️ Undo / Redo β€” Full command stack with dirty-state tracking
  • πŸ“‹ Clipboard β€” In-app range copy/paste with formula reference shifting + system TSV fallback
  • ⚑ Autofill β€” Drag-to-fill with arithmetic and pattern detection
  • πŸ”’ Live Formula Engine β€” AST-based evaluator with real-time dependency recalculation
  • πŸŽ›οΈ Workbook Actions β€” Extensible action menu (bottom sheet on mobile, popup on desktop)
  • βœ… Validation β€” Rule-based cell validation with visual feedback
  • πŸ§ͺ 324 Tests β€” Comprehensive coverage across engine, widget, and integration layers

Feature Highlights

Feature Detail
⚑ Virtualized Rendering 60+ FPS even with millions of cells β€” direct Canvas painting, no per-cell widgets
πŸ“¦ XLSX & CSV Support Native parsers for Excel and CSV files β€” no WebView, no external services
πŸ–ŠοΈ Cell Editing Inline editor overlay; tap to edit, type = for formulas
πŸ”’ Formula Engine AST tokenizer + evaluator with live dependency graph recalculation
↩️ Undo / Redo Command-pattern stack; integrates with dirty-state and save lifecycle
πŸ“‹ Clipboard Copy/paste ranges with formula shifting; reads system TSV from Excel/Sheets
⚑ Autofill Drag handle to extend values or arithmetic sequences
πŸ’Ύ Persistence Hooks Full save lifecycle β€” dirty tracking, save, save as, discard, close interception
πŸŽ›οΈ Workbook Actions Extensible menu with built-in and developer-injected actions
βœ… Validation Cell-level rules with blocked input and visual indicators
πŸ“ Merged Cells Pixel-perfect hit-testing and rendering for complex layouts
🎨 Full Theming SheetifyeThemeData with dark mode auto-detection
🌐 Cross-Platform iOS, Android, Web, Windows, macOS, Linux

Supported Platforms

Platform Support Rendering
iOS βœ… Native Canvas
Android βœ… Native Canvas
Web βœ… CanvasKit / HTML
Windows βœ… Native Canvas
macOS βœ… Native Canvas
Linux βœ… Native Canvas

Installation

flutter pub add sheetifye

Or add to pubspec.yaml manually:

dependencies:
  sheetifye: ^1.1.0

Sheetifye uses Riverpod for state management. Wrap your app root in a ProviderScope once β€” if you already use Riverpod, no additional setup is needed.


Quick Start

1. Initialize

void main() {
  runApp(const ProviderScope(child: MyApp()));
}

2. View a Spreadsheet (read-only)

import 'package:sheetifye/sheetifye.dart';

Sheetifye.asset('assets/reports/sales_2024.xlsx')

3. Enable Editing + Save Lifecycle

Sheetifye.asset(
  'assets/reports/sales_2024.xlsx',
  readOnly: false,
  onSave: (workbook) async {
    await myApi.save(WorkbookExporter.toJson(workbook));
    return true; // mark clean
  },
  onSaveAs: (workbook) async {
    final bytes = WorkbookExporter.toXlsxBytes(workbook);
    await FilePicker.saveFile(bytes);
    return true;
  },
  onBeforeClose: () async {
    // Return true to allow close, false to cancel
    return await showSaveDialog(context);
  },
  onWorkbookChanged: (workbook, isDirty) {
    saveIndicator.value = isDirty;
  },
)

Usage Examples

πŸ“ Load from Asset

Sheetifye.asset('assets/template.xlsx')

🌐 Load from Network

Sheetifye.network(
  'https://api.example.com/reports/latest.xlsx',
  headers: {'Authorization': 'Bearer $token'},
)

πŸ’Ύ Load from File

Sheetifye.file(File('/storage/emulated/0/Download/report.xlsx'))

🧠 Load from Memory (e.g. file picker)

final result = await FilePicker.platform.pickFiles(withData: true);
Sheetifye.memory(result!.files.first.bytes!)

πŸ“Š Load a CSV File

Sheetifye.network('https://data.example.com/export.csv')
// CSV is auto-detected by file extension

Editing & Formula Entry

When readOnly: false, users can:

  • Double-tap (mobile) or press Enter / F2 (desktop) to open the inline cell editor
  • Type = to enter formula mode β€” the formula bar shows the expression, the cell shows the result
  • Tab / Enter to confirm and advance to the next cell
  • Escape to cancel
Sheetifye.asset(
  'assets/data.xlsx',
  readOnly: false, // ← enables the editing system
)

Undo & Redo

Every edit is captured in a command stack. Users can undo/redo via:

  • Keyboard shortcuts β€” Ctrl+Z / Ctrl+Y (desktop)
  • Workbook action menu β€” Undo and Redo built-in actions

The onWorkbookChanged callback fires after each undo/redo, keeping your UI in sync.


Workbook Actions

The workbook action menu provides extensible workbook-level operations. Built-in actions include Save, Save As, Export CSV, Export XLSX, Undo, Redo, and Discard Changes. Add your own:

import 'package:sheetifye/sheetifye.dart';

Sheetifye.asset(
  'assets/data.xlsx',
  customActions: [
    WorkbookAction(
      id: 'app.share',
      label: 'Share with Team',
      icon: Icons.share,
      group: WorkbookActionGroup.sharing,
      onExecute: (context, ref) async {
        final workbook = ref.read(workbookProvider).workbook;
        final csv = WorkbookExporter.toCsv(workbook);
        await Share.share(csv);
      },
    ),
  ],
)

The menu renders as a bottom sheet on mobile and a popup menu on desktop/web automatically.


Persistence & Export

Dirty State

onWorkbookChanged: (workbook, isDirty) {
  // isDirty == true when there are unsaved changes
  setState(() => _hasUnsavedChanges = isDirty);
},

Export Formats

// JSON (for custom backends)
final json = WorkbookExporter.toJson(workbook);

// CSV (active sheet)
final csv = WorkbookExporter.toCsv(workbook);

// XLSX bytes (for file saving)
final bytes = WorkbookExporter.toXlsxBytes(workbook);

Custom Theming

Sheetifye.asset(
  'assets/data.xlsx',
  theme: SheetifyeThemeData.light().copyWith(
    primaryColor: Colors.deepPurple,
    headerBackground: Colors.grey[50],
    gridColor: Colors.blueGrey[100],
    fontFamily: 'Inter',
  ),
)

Dark mode is detected automatically from Theme.of(context).brightness when no theme is provided.


Architecture

Sheetifye follows a layered engine architecture with direct Canvas rendering at its core.

lib/src/
β”œβ”€β”€ domain/     Pure entities β€” Workbook, Sheet, Cell, CellRange
β”œβ”€β”€ data/       Adapters β€” XLSX parser (isolate), CSV parser, serializer
β”œβ”€β”€ engine/     Runtime systems β€” Formula, Clipboard, Autofill, Overlays, Structure
β”œβ”€β”€ features/   Riverpod state + UI β€” Workbook, Grid, Toolbar, Formula Bar, Actions
β”œβ”€β”€ core/       Theme, utilities, grid layout math
└── public/     Consumer-facing API β€” Sheetifye widget, WorkbookExporter, PersistenceOptions

Key design decisions:

  • Canvas-first β€” The grid draws directly to Canvas, bypassing the Flutter widget tree per cell for maximum throughput.
  • Isolate parsing β€” XLSX and CSV files are parsed in a compute() isolate, keeping the UI thread free.
  • Command pattern β€” Every mutation is encapsulated in a command, enabling undo/redo and dirty-state tracking.
  • Dependency graph β€” The formula engine tracks cell relationships for surgical re-evaluation on edit.

β†’ Full details in Architecture Guide


Comparison

Feature Sheetifye Syncfusion PlutoGrid
XLSX Parsing βœ… Native 🟑 Add-on required ❌ None
CSV Support βœ… RFC-4180 🟑 Basic ❌ None
Cell Editing βœ… Full βœ… Full βœ… Full
Formula Engine βœ… AST Native 🟑 Partial ❌ None
Undo / Redo βœ… Command stack 🟑 Limited ❌ None
Clipboard βœ… In-app + System 🟑 Basic ❌ None
Autofill βœ… Smart fill ❌ None ❌ None
Virtualization βœ… Full βœ… Full 🟑 Partial
Memory Usage πŸ’Ž ~42 MB πŸ”΄ ~180 MB 🟑 ~120 MB
License MIT πŸ’° Commercial MIT

Testing

Sheetifye ships with 324 passing tests across 31+ test files:

Category Files Coverage
Engine β€” Persistence 12 Dirty state, save lifecycle, crash resistance, recovery, export, async save
Engine β€” Formula 2 Tokenizer, evaluator, dependency resolution
Engine β€” Clipboard 1 In-app range copy/paste, TSV parsing, formula shifting
Engine β€” Editing 1 Cell mutations, validation, undo/redo interaction
Engine β€” Undo/Redo 1 Command stack, dirty state after undo
Engine β€” Sorting/Filtering 2 Multi-column sort, filter state
Engine β€” Autofill 1 Pattern detection, arithmetic sequences
Engine β€” Virtualization 1 Viewport calculation, scroll accuracy
Engine β€” Merged Cells 1 Layout, selection, hit-testing
Widget Tests 5 Formula bar, grid, toolbar, editor overlay, workbook
Integration Tests 5+ Mobile UX, desktop UX, web, stress, XLSX samples

Run the full suite:

fvm flutter test

Roadmap

  • x v1.0.0 β€” Native XLSX viewer, virtualized grid, formula bar, merged cells, theming
  • x v1.1.0 β€” Full editing system, persistence lifecycle, undo/redo, clipboard, autofill, formula engine, workbook actions, validation, mobile UX
  • v1.2.0 β€” Conditional formatting, charts, cell comments, multi-sheet editing
  • v2.0.0 β€” Collaborative editing hooks, advanced styling, named ranges, pivot-table rendering

Contributing

We welcome contributions! Please read the Contributing Guide before opening a PR. Key requirements:

  • fvm flutter test must pass (324+ tests)
  • fvm flutter analyze must report zero issues
  • New features must include tests and updated docs

License

Sheetifye is released under the MIT License. See LICENSE for details.


Built with ❀️ by Vikas Poute

⭐ If Sheetifye saves you time, please give it a star on GitHub. ⭐

Libraries

sheetifye