---
title: "table_import"
description: "Imports the rows of a SQL `SELECT`, such as a spreadsheet's, as new records of a table, and lists the refused rows."
---

| Operation | OAuth scope | Description |
| :-- | :-- | :-- |
| `table_import` | `files:write` | Runs one `SELECT`, as `sql` does, and saves each result row as a new record of the table against `schemaVersion`, in one transaction. The rows never pass through the agent's context. Column names are the fields, and a `NULL` column leaves its field out. Valid rows are saved. A row that fails the schema, a reference or a unique key is not saved and comes back in `failingRows`, with its row number (from 1), the refusal code and its first issues; `failingCount` counts them all. With `check: true` nothing is written, and the same report shows what the import would save and refuse. At most 5,000 rows. Reuse the `requestId` to retry the import: an import already saved under it returns its original report with `replayed: true`, without running the query again, and the same `requestId` with another query or `schemaVersion` fails `request_conflict`. `check: true` always previews the current query and saves nothing. |

Group: [Tables, records and exports](/docs/en-US/agents/mcp/tables-records-and-exports).
