# Databases

> Look up how a built-in database is organized and how Import CSV maps a file's columns to a table's fields.

A database in **Databases** holds up to 20 tables. Each table holds up to 50 fields and 50,000 rows, and a field is text, number, checkbox, date, date and time, select, multiple select, person, created by, last modified by, autonumber, or attachment. A text or number field can also carry a format: currency, percent, rating, or duration on a number, and URL, email, phone, long text, or Markdown on a text. The format is chosen in the **Format** select of the field dialog and can be changed or removed later, with the rows kept as they are; the type cannot be changed after the field is created. A date and time field holds a moment, stored in UTC and shown in each person's own time zone. The grid and the row sheet edit it with the browser's date-and-time control. A filter on it takes a date and matches that day in UTC, as a filter on **Created** or **Updated** does. A multiple select field holds several of its options at once, from the same **Options** list a select field has. The grid shows them as badges and edits them as chips, and a filter on the field reads **has any of**, **has all of**, or **has none of** with the options to match. Members add tables and fields, edit rows in the grid on a table's page, and import rows from a CSV file. Viewers read the grid. Workflows read and write a table through the [database blocks](https://outwin.ai/docs/reference/blocks/#database-blocks).

A person field holds one workspace member per cell, and someone who leaves the workspace keeps their name there, marked as a former member. **Created by** and **Last modified by** are filled in by OutWin with whoever added the row or last changed it: a member, or a workflow shown as "Workflow:" and its name. Anyone who cannot open that workflow's project sees "A workflow" instead, and so does everyone once the workflow is deleted. Rows that existed before either field was added show nothing in it. An autonumber field numbers rows 1, 2, 3, and so on in the order they are added and never reuses a number; added to a table that has rows, it numbers them in creation order. Nobody can edit these three fields, and a workflow cannot write them. A filter on a created by or last modified by field matches a member, never a workflow.

An attachment field holds up to 20 images, PDFs, or videos in each cell, picked from the workspace's Assets library or uploaded on the cell. An uploaded file goes into the library like any other upload. Like every asset, it is public to anyone with its link. Deleting a file in the library leaves the cell showing "Removed file", and no workflow receives it after that. A filter on the field reads **is empty** or **is not empty**.

A connected Postgres database appears in the same area with the tables it was read from. Its rows are read-only in the grid, so it has no Import CSV.

## Import a CSV file

Import CSV adds the rows of a `.csv` file to a built-in table, or creates a table from the file. On a table's page, the **⋮** menu offers **Import CSV into this table** under **Table** and **Import CSV as a new table** under **Database**. A database with no tables yet shows **Import CSV as a new table** beside **Add table**. Both need the member role or higher. Notion and Airtable exports are plain CSV and import as they are.

The dialog has three stages: choose the file, map its columns, and import. Nothing is written until **Import** is selected.

### Choose the file

The file is read in the browser as UTF-8 and parsed as comma-separated values. Fields in double quotes can hold commas, line breaks, and doubled quotes. A tab- or semicolon-separated file arrives as one column. A file can have at most 10 MB, 20,000 rows, and 50 columns. A larger file is refused before anything is sent, with a sentence such as "The file has 24,000 rows; at most 20,000 can be imported at once. Split it and import each part."

**First row is the header** is on by default and names the columns from the first row. A blank header becomes `Column 3`, a header already used becomes `Name (2)`, and a header longer than 60 characters is cut. With the switch off, every row is data and the columns are `Column 1`, `Column 2`, and so on. Rows with nothing in any cell are dropped. A short row reads as empty cells.

A preview shows the first 20 rows under the column names. The row and column counts sit beneath it. For a new table, **Table name** is filled from the filename and can be changed. A name another table in the database already has cannot be used. **Next** opens the mapping.

### Map the columns

Each column gets one row in the mapping: its name, up to three sample values, and where it goes. The choice is one of the table's fields, **Create field**, or **Skip**. **Create field** shows a second choice for the new field's type: **Text**, **Number**, **Checkbox**, **Date**, or **Date and time**. The import never creates a select, multiple select, person, or attachment field, or any of the three fields OutWin fills. Map a column of option names, of members' emails or names, or of asset links or names to an existing field, or import it as text. A created by, last modified by, or autonumber field is not offered as a target; the import fills it as it adds each row, with the person importing and the next numbers.

The mapping starts filled in. A column whose header matches a field's name, in any capitalization, goes to that field, and each field is claimed by one column at most. Any other column is skipped when the table exists and creates a field when the table is new. A column named with a leading `_` is skipped, which covers the `_id` and `_createdAt` columns of an OutWin export. For a new table, the first column fills **Name** unless a header already claimed it.

The guessed type for a created field comes from the column's non-empty values. It is **Number** when every one is a number, **Checkbox** when every one is `true`, `false`, `yes`, or `no`, **Date** when every one is written as `YYYY-MM-DD`, and **Date and time** when every one is an ISO 8601 date and time such as `2026-11-23T09:00:00Z`. Anything else is **Text**, and so is a column with no values. A created field also gets a guessed format. A column is **Number** with the **Percent** format when every value ends in `%`, and with the **Currency** format when every value starts with the same symbol (`$`, `€`, `£`, or `¥`). It is **Text** with the **URL** format when every value starts with `http://` or `https://`, and with the **Email** format when every value is an address. The choice then reads **Create field · Percent**.

**Import** stays off while the mapping has a problem, and the problem is written under the list:

| Message | Cause |
| --- | --- |
| `"Email" and "E-mail" both go to Email. Map each field from one column.` | Two columns are mapped to the same field. |
| `Field names cannot start with an underscore, so "_id" cannot become a field. Skip it.` | A column named with a leading `_` is set to **Create field**. |
| `The table already has a field called Status. Map "Status" to it or skip the column.` | A created field would share a name with an existing field. |
| `Two columns would create a field called Status. Skip one of them.` | Two columns set to **Create field** have the same name. |
| `A table can have at most 50 fields; this import would make 53. Skip 3 more columns.` | The existing fields and the created ones exceed the limit. |
| `Every column is skipped. Map at least one to a field.` | No column is mapped. |

**Back** returns to the file stage. The mapping is kept until the file or the header switch changes. The button reads **Import 1,240 rows**, with the count of data rows in the file.

### What happens during the import

The dialog cannot be closed while rows are being sent. A new table is created first, and the progress line reads "Creating the table…". Columns set to **Create field** are then added to the table together ("Adding 3 fields…"). The table's schema is its list of fields, and the import waits up to 15 seconds for the change to apply ("Updating the table's schema…") before it stops with `The table's schema is still updating. Try again in a moment.`

Rows are sent in batches of 200, and a progress bar reads "200 of 1,240 rows". Each row is checked on its own. A row with a value its field cannot take is skipped, and the rest of its batch is still written. An empty cell leaves the field empty, or unchecked for a checkbox. A text value longer than 20,000 characters is kept, cut at that length, and counted as a cut cell. A row whose values add up to more than 256 KB is skipped.

| Field type | Values that fit |
| --- | --- |
| Text | Anything, unless the field has the URL, email, or phone format, which takes only a web address, an email address, or a phone number with at least five digits. A URL field puts `https://` in front of a bare host such as `example.com`. A long text or Markdown field takes anything. |
| Number | Digits with an optional sign and decimal point, such as `-12.5`. For a number field without a format, a thousands separator or a currency symbol, as in `1,240` or `$12`, does not fit. A field with a format reads its own notation: a currency field takes `$1,240` or `1,240`, a percent field takes `25%` and stores 0.25, a duration field takes `1:30:00` or seconds, and a rating field takes a whole number from 0 to its maximum. |
| Checkbox | `true`, `false`, `yes`, `no`, `1`, or `0`, in any capitalization. |
| Date | `YYYY-MM-DD`, or a date and time written as `YYYY-MM-DDThh:mm`, of which the date part is kept. `01/11/2026` does not fit. |
| Date and time | An ISO 8601 date and time with any offset, such as `2026-11-23T09:00:00Z` or `2026-11-23T10:00+01:00`, kept as the moment in UTC, or a date as `YYYY-MM-DD`, which is read as midnight UTC. An OutWin export writes the field as its UTC value, so it imports back as it is. |
| Select | The name of one of the field's options, in any capitalization. An unknown name skips the row. The import never adds an option. |
| Multiple select | The names of the field's options separated by commas, in any capitalization, so `AI, Ops` imports as both options. A name given twice counts once, and an option whose name contains a comma cannot be imported. An unknown name skips the row, and the import never adds an option. An OutWin export writes the field the same way, so it imports back as it is. |
| Person | A member's email or exact name, in any capitalization. Only current members of the workspace fit. A name two members share does not fit, so use the email. |
| Attachment | The links or names of files in the workspace's Assets library, separated by commas, such as `Brochure, Logo`. A file given twice counts once, and a row naming more than 20 files is skipped. A name or link that matches no file skips the row, because the import never uploads one. An OutWin export writes the field as the files' links separated by commas, so it imports back as it is. |

When the last batch is written, the summary reads "1,240 rows added, 3 skipped, 2 cells cut." Below it, the first 50 skipped rows are listed by their row number in the file, counting the header as row 1, each with its reason, such as `Row 17` `Status has no option "Archived"`. A longer list ends with "and 12 more; download them to see every one." **Download skipped rows** saves them as `<filename> - skipped rows.csv`: the file's own columns, plus a `reason` column holding the sentence. Cut cells are listed the same way, as `Row 40` `Notes was cut at 20000 characters`. They are not in the download.

| Reason a row is skipped | Example |
| --- | --- |
| A number field without a format got something else. | `Amount needs a number, not "n/a"` |
| A field with a format got a value it cannot read. The message names what the format needs. | `Site needs a web address, not "n/a"` |
| A checkbox field got something other than yes or no. | `Done needs yes or no, not "maybe"` |
| A date field got another format. | `Due needs a date as YYYY-MM-DD, not "01/11/2026"` |
| A date and time field got something that is not a date or an ISO 8601 date and time. | `Starts needs a date or an ISO datetime, not "tomorrow"` |
| A select or multiple select field got a name that is not one of its options. For a multiple select, the message names the first unknown one. | `Status has no option "Archived"` |
| A person field got an email or name that is not a current member's, or a name two members share. | `Owner has no member "carol@example.com" in this workspace` |
| An attachment field got a name or link that matches no file in the workspace's Assets library. | `Files has no asset "Brochure" in this workspace` |
| The row is too large. | `The row is larger than 256 KB.` |

**Done** closes the dialog. A new table opens on its own page, and an existing table's grid shows the rows.

### When the import stops

A failure before the first batch is written, such as a database that already has 20 tables, shows its reason in a message and returns the dialog to the mapping. A failure after some rows were written keeps them. The summary counts what was added, and a line reads `The import stopped at row 601: The database could not be reached. Try again in a moment. The rows above were kept; the rest of the file was not sent.` Import the rest of the file as a second run, without the rows that were added.

| Message | Cause |
| --- | --- |
| `A column in this import is mapped to a field the table no longer has. Map the columns again.` | A mapped field was deleted while the import ran. The batch that met it was not written. |
| `This table is at its row or storage limit.` | The table has reached 50,000 rows, or the database its 500 MB. |
| `The database could not be reached. Try again in a moment.` | The storage did not answer in time. |
| `The table's schema is still updating. Try again in a moment.` | A schema change has not applied after 15 seconds. |

Each batch counts against a limit of 240 row writes per minute per person, so three imports of 20,000 rows in the same minute cannot all go through.
