Data Import & Export
Este conteúdo não está disponível em sua língua ainda.
Overview
Section titled “Overview”Rebase includes built-in data import and export tools accessible directly from the admin panel. Import supports CSV, JSON, and Excel files with a column-mapping wizard. Export supports CSV and JSON with optional computed fields.
Both features are enabled by default on all collections and can be configured or disabled per collection.
Importing Data
Section titled “Importing Data”How to Import
Section titled “How to Import”- Open a collection in the admin panel
- Click the Import button in the toolbar
- Select or drag-and-drop your file
- Map file columns to collection properties
- Preview the data and resolve any validation errors
- Click Import to save all entities
Supported Formats
Section titled “Supported Formats”| Format | Extensions | Notes |
|---|---|---|
| CSV | .csv | Auto-detects delimiters |
| JSON | .json | Expects an array of objects |
| Excel | .xlsx | Reads the first sheet |
Column Mapping
Section titled “Column Mapping”The import wizard automatically attempts to match file columns to collection properties by name. You can manually adjust mappings before importing:
- Exact matches are mapped automatically (e.g.
name→name) - Unmatched columns can be mapped manually or skipped
- Type coercion handles string-to-number, string-to-boolean, and date parsing
Validation
Section titled “Validation”Before importing, the wizard validates all rows against your collection’s property definitions:
- Required fields must be present
- Enum values must match defined options
- Data types must be compatible (e.g. a text value for a number field is flagged)
- Validation errors are shown per-row so you can fix them before importing
Import Configuration
Section titled “Import Configuration”Import is enabled by default. To disable it on a specific collection, use the ui sub-object:
import { EntityCollection } from "@rebasepro/types";
const productsCollection: EntityCollection = { slug: "products", name: "Products", properties: { /* ... */ }, // Import is enabled by default};Exporting Data
Section titled “Exporting Data”How to Export
Section titled “How to Export”- Open a collection in the admin panel
- Optionally apply filters to export a subset of data
- Click the Export button in the toolbar
- Choose the format: CSV or JSON
- The file downloads immediately
Export Formats
Section titled “Export Formats”| Format | Description |
|---|---|
| CSV | Comma-separated values, compatible with Excel and Google Sheets |
| JSON | Array of objects, useful for programmatic consumption |
Filtering Before Export
Section titled “Filtering Before Export”Any active filters in the collection view are applied to the export. This lets you export only a subset of your data:
- Apply column filters or search terms in the collection view
- Click Export — only the filtered rows are included
Export Configuration
Section titled “Export Configuration”Export is enabled by default. You can configure it with additional computed fields:
import { EntityCollection } from "@rebasepro/types";
const productsCollection: EntityCollection = { slug: "products", name: "Products", exportable: true, // Enable (default: true) properties: { /* ... */ }};To disable export:
const productsCollection: EntityCollection = { slug: "products", name: "Products", exportable: false, properties: { /* ... */ }};Adding Computed Fields
Section titled “Adding Computed Fields”Use the ExportConfig object to add custom computed columns to your exports. These columns don’t exist in the database — they are calculated at export time:
import { EntityCollection } from "@rebasepro/types";
const productsCollection: EntityCollection = { slug: "products", name: "Products", exportable: { additionalFields: [ { key: "computed_margin", builder: ({ entity }) => { const price = entity.values.price as number; const cost = entity.values.cost as number; return String(price - cost); } }, { key: "full_url", builder: ({ entity }) => { return `https://mystore.com/products/${entity.id}`; } } ] }, properties: { /* ... */ }};Each additionalFields entry has:
| Property | Type | Description |
|---|---|---|
key | string | Column name in the export |
builder | ({ entity, context }) => string | Promise<string> | Function that computes the value |
The builder function receives the current entity and the RebaseContext (which includes the authenticated user), so you can compute values based on both data and permissions.
Async Computed Fields
Section titled “Async Computed Fields”The builder function can be async, which is useful when the computed value requires a database lookup or API call:
exportable: { additionalFields: [ { key: "author_name", builder: async ({ entity, context }) => { const author = await context.data.users.findById( entity.values.author_id as string ); return author?.values.displayName ?? "Unknown"; } } ]}Next Steps
Section titled “Next Steps”- Collections — Define your data model
- Frontend Overview — Admin panel and UI components
- Client SDK — Programmatic data access