Skip to content
Zonvoir Table LogoZonvoir Table

Excel & CSV Data Exports

Zonvoir Table includes export definitions through Zonvoir\ZonvoirTable\Export. Exports are returned from a table class and serialized into the table metadata so the Vue adapter can render export controls and submit to the package export endpoint.

Override exports() on your table class and return Export instances.

use Zonvoir\ZonvoirTable\Export;
use Zonvoir\ZonvoirTable\Table;
final class UsersTable extends Table
{
public function exports(): array
{
return [
Export::make('Users', 'users.xlsx')
->limitToFilteredRows(),
];
}
}

When a table has at least one export, Table::meta() includes the table class and exportEndpoint route metadata.

Exports can opt into the current filtered query state or the selected rows.

Export::make('Selected users', 'selected-users.xlsx')
->limitToSelectedRows();
Export::make('Filtered users', 'filtered-users.xlsx')
->limitToFilteredRows();

Selected-row exports use the table row selection key. By default, Table uses id.

Use queue() when the export should be processed asynchronously. The export API also supports a queued job callback and redirect metadata.

Export::make('Users', 'users.xlsx')
->queue(filename: 'queued-users.xlsx')
->redirectBackWithDialog(
title: 'Export started',
message: 'Your file is being prepared.'
);

Use using() to provide a custom exporter callback.

Export::make('Users')
->using(function ($table, $request, $query) {
// Return a response, redirect, or custom export result.
});

The implementation invokes the custom exporter through Export::executeUsing(Table $table, ExportRequest $request, Builder $query).

Column export output can be customized on the column itself.

TextColumn::make('name')
->exportLabel('Customer')
->exportAs(fn ($value, $record) => strtoupper($value));

Use dontExport() on a column to exclude it from generated export headings and row values.