> ## Documentation Index
> Fetch the complete documentation index at: https://docs.revoengine.com/llms.txt
> Use this file to discover all available pages before exploring further.

# api.exportDatabase()

> Public low-code contract, signatures and examples for api.exportDatabase.

## `api.exportDatabase()`

Exports a logical table, saved view, or materialized view by name directly into Storage as CSV, TSV, NDJSON, or XLSX.
The root and every structured join may independently target any of these relation types.

Notes:

* Unavailable with `readOnly: true` (throws an error).
* By default waits for the export, final compose, and storage entry persistence.
* CSV is the default and its dialect, headers, and byte map are indexed during upload.
* XLSX streams directly from the database through the native Storage writer into the final resumable upload,
  preserves database value types where Excel supports them, and runs a server-side COUNT(\*) before starting.
  A failed export is discarded and can be retried by its job; a header row leaves 1,048,575 data rows available.
* By default the call completes synchronously in its current runtime. Set `async: true` to queue it on Processor and receive a jobId.
* Omit `storageDestination` for private user storage, use `ROOT` for Explorer root,
  or provide an accessible Explorer folder storageEntryId.

### Signature

```ts theme={null}
static exportDatabase<TAsync extends boolean = false>(
      name: string,
      options?: ExportDatabaseOptions & { async?: TAsync },
    ): Promise<
      TAsync extends true
        ? ExportDatabaseAcceptedResponse
        : TAsync extends false
          ? ExportDatabaseCompletedResponse
          : ExportDatabaseResponse
    >;
```

### Example

```ts theme={null}
const result = await api.exportDatabase('contracts', {
  format: 'xlsx',
  storageDestination: 'ROOT',
  fileName: 'contracts-full.xlsx',
  restricted: false,
  fields: ['contractId', 'customerId'],
  sort: { contractId: 'ASC' },
});

return result.storageEntryId;
```

See [all api methods](https://docs.revoengine.com/low-code/reference/api.md) or [runtime basics](https://docs.revoengine.com/low-code/overview.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.