# Import and export workflows

Comind.work provides several ways to import data into and export data from your workspaces - from UI-based uploads to programmatic bulk operations.

## Importing records[​](#importing-records "Direct link to Importing records")

### From the UI[​](#from-the-ui "Direct link to From the UI")

Use the built-in data import feature to upload records from spreadsheet files:

1. Navigate to the target app in your workspace
2. Open the list menu and select **Import data**
3. Upload a CSV or XLSX file
4. Map file columns to app fields
5. Choose how to handle duplicates
6. Preview the results and confirm the import

### From the CLI[​](#from-the-cli "Direct link to From the CLI")

Two CLI commands are available for importing records:

**createRecords** - create new records from a file:

```
npx comind createRecords <app> <workspace> <file>
```

**importRecords** - import with full control over duplicate handling:

```
npx comind importRecords <app> <workspace> <file>
```

Duplicate handling modes:

| Mode   | Behavior                                           |
| ------ | -------------------------------------------------- |
| Block  | Fail the entire import if any duplicates are found |
| Skip   | Silently ignore duplicate records                  |
| Import | Update existing records (upsert)                   |

Action modes:

| Mode            | Behavior                                         |
| --------------- | ------------------------------------------------ |
| CreateAndUpdate | Create new records and update existing matches   |
| CreateOnly      | Only create, skip existing                       |
| UpdateOnly      | Only update, skip new                            |
| Preview         | Dry run - show what would happen without changes |

### From code (server-side)[​](#from-code-server-side "Direct link to From code (server-side)")

Use `ComindServer.importData()` in action code for programmatic imports:

```
await ComindServer.importData({
  wksAlias: "MY_WORKSPACE",
  appAlias: "CONTACTS",
  data: records,
  keyFields: ["external_id"],
  duplicateRow: "Import",          // 'Block' | 'Skip' | 'Import'
  importActions: "CreateAndUpdate", // 'CreateAndUpdate' | 'CreateOnly' | 'UpdateOnly' | 'Preview'
  fields: [
    { dataColumnName: "ext_name", storeInto: "title" },
    { dataColumnName: "ext_date", storeInto: "creation_date" }
  ]
});
```

Each entry in the `fields` array is an `ImportDataField` with properties including `dataColumnIndex`, `dataColumnName`, `isKey`, `storeInto`, `linkToMatchByFieldName`, `lookupMatchBy`, `userMatchBy`, `behaviourOnNoMatch`, `defaultValue`, and `csvDelimiter`.

## Importing list views[​](#importing-list-views "Direct link to Importing list views")

Import saved list view configurations (filters, columns, sort order) using the CLI:

```
npx comind importCustomViews
```

## Exporting data[​](#exporting-data "Direct link to Exporting data")

### From the UI[​](#from-the-ui-1 "Direct link to From the UI")

Export the current list view to Excel:

1. Open any list view
2. Click the **Export** button in the toolbar
3. The export respects your current filters, sorting, and visible columns

The export produces an XLSX file.

### From the CLI[​](#from-the-cli-1 "Direct link to From the CLI")

**dump** - export a running app schema back to TypeScript source files:

```
npx comind dump <app-id> <target-directory>
```

Converts compiled JavaScript back into editable TypeScript components (fields, actions, views, settings). Useful for migrating apps from the web editor to code-based development.

**dumpLint** - same as dump, with ESLint auto-formatting:

```
npx comind dumpLint <app-id> <target-directory>
```

## Zero-code to code workflow[​](#zero-code-to-code-workflow "Direct link to Zero-code to code workflow")

Move an app from the web editor to code-based development by exporting its compiled schema to TypeScript:

```
npx comind dump <app-id> ./apps/my-app
```

This produces a complete app package (`fields/`, `actions/`, `views/`, `settings/`) that your developers can extend in their IDE and deploy via `npx comind install`. From that point on, the code in Git is the source of truth - further edits in the web editor will be overwritten by the next install.

## Related[​](#related "Direct link to Related")

* [Data import (end-user guide)](/user-guide/app-records-list/data-import.md) - how end users import records from spreadsheets via the UI
* [Data import and export (developer guide)](/developer-guide/how-to/advanced/data-import-export.md) - programmatic import/export patterns for app developers
