# Filament Spreadsheet

![Filament Spreadsheet](https://raw.githubusercontent.com/packstub/art/main/filament-spreadsheet/banner.jpg)

An inline-editable table for bulk editing Eloquent records in Filament v4 (4.13+) and v5. A sheet page for any resource: edit cells with the keyboard, paste rows from Excel or Google Sheets, fill down, undo, and press Save once; the server validates every cell with your rules, checks your policies row by row, detects conflicts and writes the batch in one transaction. Free and open source (MIT), built on [Tabulator](https://tabulator.info) (MIT).

- Repository: [github.com/packstub/filament-spreadsheet](https://github.com/packstub/filament-spreadsheet)
- Packagist: [packstub/filament-spreadsheet](https://packagist.org/packages/packstub/filament-spreadsheet)
- Support: [GitHub issues](https://github.com/packstub/filament-spreadsheet/issues)

## Features

- **[One Save for hundreds of cells](https://packstub.dev/docs/filament-spreadsheet/saving)**: edits wait across pages, one transaction writes them.
- **[Rules, policies and conflicts on the server](https://packstub.dev/docs/filament-spreadsheet/saving)**: every cell validated, every row authorized.
- **[A keyboard grid](https://packstub.dev/docs/filament-spreadsheet/editing)**: ranges, fill down, undo and redo.
- **[Paste from Excel or Sheets](https://packstub.dev/docs/filament-spreadsheet/editing)**: extra rows become new records.
- **[Seven column types](https://packstub.dev/docs/filament-spreadsheet/columns)**: text, number, boolean, select, dates and formulas.
- **[Add and delete rows](https://packstub.dev/docs/filament-spreadsheet/rows)**: behind your policy, written with the next Save.
- **[Search, sort, filters and pages](https://packstub.dev/docs/filament-spreadsheet/browsing)**: on the server, unsaved cells kept.
- **[A resource page or your own](https://packstub.dev/docs/filament-spreadsheet/first-sheet)**: an Edit as sheet button on any resource.
- **[Events and hooks](https://packstub.dev/docs/filament-spreadsheet/events)**: `RowsSaved`, `RowSaveFailed`, before and after a save.
- **[Dark mode, RTL and translations](https://packstub.dev/docs/filament-spreadsheet/styling)**: Tabulator bundled, nothing else to install.

## Guides

| Guide | What it covers |
| --- | --- |
| [Installation](https://packstub.dev/docs/filament-spreadsheet/installation) | Requirements, the package, the config file, the plugin |
| [Your first sheet](https://packstub.dev/docs/filament-spreadsheet/first-sheet) | A resource page, the `SheetAction`, what the query decides |
| [Columns](https://packstub.dev/docs/filament-spreadsheet/columns) | Every column type and option, relationships, computed values, read-only cells, rules |
| [Editing](https://packstub.dev/docs/filament-spreadsheet/editing) | The keyboard map, paste from Excel or Sheets, fill-down, undo |
| [Saving](https://packstub.dev/docs/filament-spreadsheet/saving) | The batch, errors on cells, conflicts, all-or-nothing versus per-row |
| [Adding and deleting rows](https://packstub.dev/docs/filament-spreadsheet/rows) | New rows with defaults, deletions, what the policy gates |
| [Search, sort, filters, pagination](https://packstub.dev/docs/filament-spreadsheet/browsing) | The toolbar, unsaved changes across pages |
| [Authorization](https://packstub.dev/docs/filament-spreadsheet/authorization) | Policies, closures, read-only mode, greyed rows |
| [Tenancy](https://packstub.dev/docs/filament-spreadsheet/tenancy) | Resource pages in a tenant panel, standalone pages |
| [Events and hooks](https://packstub.dev/docs/filament-spreadsheet/events) | `RowsSaved`, `RowSaveFailed`, `beforeSave()`, `afterSave()`, `mutateRowBeforeSave()` |
| [A sheet outside a resource](https://packstub.dev/docs/filament-spreadsheet/standalone) | `SpreadsheetPage` and the trait in any Livewire component |
| [Styling](https://packstub.dev/docs/filament-spreadsheet/styling) | The CSS variables, dark mode, RTL, translations |
| [Performance](https://packstub.dev/docs/filament-spreadsheet/performance) | Page sizes, thousands of rows, what is queried when |
| [Editable columns vs a sheet](https://packstub.dev/docs/filament-spreadsheet/comparison) | When to use which, and the neighbours: import, export, a Sheets-like document |
| [Upgrading](https://packstub.dev/docs/filament-spreadsheet/upgrading) | Version notes |

## At a glance

```bash
composer require packstub/filament-spreadsheet
php artisan filament:assets
```

```php
use Packstub\Spreadsheet\Columns\NumberColumn;
use Packstub\Spreadsheet\Columns\SelectColumn;
use Packstub\Spreadsheet\Columns\TextColumn;
use Packstub\Spreadsheet\Pages\SpreadsheetResourcePage;
use Packstub\Spreadsheet\Spreadsheet;

class ProductsSheet extends SpreadsheetResourcePage
{
    protected static string $resource = ProductResource::class;

    public function spreadsheet(Spreadsheet $spreadsheet): Spreadsheet
    {
        return $spreadsheet
            ->columns([
                TextColumn::make('sku')->rules(['required', 'unique:products,sku'])->frozen(),
                TextColumn::make('name')->rules(['required']),
                SelectColumn::make('category_id')->relationship('category', 'name'),
                NumberColumn::make('price')->decimals(2)->min(0),
            ])
            ->searchable(['sku', 'name'])
            ->creatable()
            ->deletable();
    }
}
```

## Requirements

PHP 8.3+, Laravel 12 or 13, Filament 4.13+ or 5.

---

These pages are published at [packstub.dev/docs/filament-spreadsheet](https://packstub.dev/docs/filament-spreadsheet) from the package's `docs/` directory. Spotted a mistake? [Open a pull request](https://github.com/packstub/filament-spreadsheet).
