# Import from Sanity

You can create a Grid by importing documents directly from your Sanity project, allowing you to work with your existing content in AirOps. If you haven't already connected your Sanity project to your AirOps workspace, you'll be prompted to do so.

### How to Import Data from Sanity

1. Click the "+" button on your Grid page
2. Select **Sanity** from the dropdown menu of import options
3. Connect to your Sanity project:
   * Select an existing Sanity authentication from the dropdown, or set up a new one by entering your **API Token** and **Project ID**
   * Click **Continue**
4. Select the dataset and document type to import:
   * If your project has multiple datasets, select which dataset to import from (defaults to "production")
   * Choose the Sanity document type (e.g., "post", "article") from the dropdown
   * Click **Continue**
5. Select which data columns to import:
   * Check the boxes next to the fields you want to include
   * Each field will show its data type and a preview of sample data
   * Note: There's a maximum limit of 100 columns
6. Click **Continue** to import your data into the Grid

### What Gets Imported

Once the import is complete, the following columns are automatically created in your Grid:

* **Sanity Import**: Shows the import status for each row
* **Sanity Document ID**: Stores the unique Sanity document identifier for each imported document
* **Created At**: The document's creation date in Sanity
* **Updated At**: The document's last update date in Sanity
* **Sanity Status**: A single-select column indicating whether the document is **Published** or **Draft**
* **Your selected fields**: Each field you chose during setup is mapped to the appropriate Grid column type

### Field Type Mapping

Sanity field types are automatically mapped to the best matching Grid column types:

| Sanity Field Type     | Grid Column Type |
| --------------------- | ---------------- |
| String                | Text             |
| Text                  | Text             |
| Number                | Number           |
| Date / Datetime       | Datetime         |
| Block (Portable Text) | HTML             |
| Image                 | Image (URL)      |
| File                  | URL              |
| Slug                  | Text             |
| Reference             | Text             |
| Geopoint              | Text             |
| Array                 | JSON             |
| Object                | JSON             |

### Draft and Published Documents

Sanity stores draft and published versions of documents separately. When both versions exist, AirOps imports the most recently updated version and reflects the document's status in the **Sanity Status** column. Draft document IDs (prefixed with `drafts.`) are normalized automatically.

### Re-running Imports

You can re-run an import at any time to sync the latest data from Sanity. Existing rows are updated based on the Sanity Document ID, and new documents are added as new rows.

Once imported, your Sanity content will appear in your Grid, ready to be enhanced with AirOps workflows for content optimization, SEO improvement, AI-powered rewrites, and more.
