Salta ai contenuti

Data Import & Export

Questi contenuti non sono ancora disponibili nella tua lingua.

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.

  1. Open a collection in the admin panel
  2. Click the Import button in the toolbar
  3. Select or drag-and-drop your file
  4. Map file columns to collection properties
  5. Preview the data and resolve any validation errors
  6. Click Import to save all entities
FormatExtensionsNotes
CSV.csvAuto-detects delimiters
JSON.jsonExpects an array of objects
Excel.xlsxReads the first sheet

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. namename)
  • Unmatched columns can be mapped manually or skipped
  • Type coercion handles string-to-number, string-to-boolean, and date parsing

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 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
};
  1. Open a collection in the admin panel
  2. Optionally apply filters to export a subset of data
  3. Click the Export button in the toolbar
  4. Choose the format: CSV or JSON
  5. The file downloads immediately
FormatDescription
CSVComma-separated values, compatible with Excel and Google Sheets
JSONArray of objects, useful for programmatic consumption

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 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: { /* ... */ }
};

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:

PropertyTypeDescription
keystringColumn 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.

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";
}
}
]
}