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

# Inspect and export data

> Inspect local or cloud extraction history, count and preview rows, and export Octoparse task data as XLSX, CSV, HTML, JSON, or XML.

The `data` command provides one interface for local and cloud extraction results.

## Choose a data source

Use `--source local|cloud`. The default source is `local`; `--local` and `--cloud` remain supported aliases.

## View extraction history

```bash theme={null}
octoparse data history <taskId> --source local --json
octoparse data history <taskId> --source cloud --json
```

For local runs created with a custom artifact directory, pass the same path:

```bash theme={null}
octoparse data history <taskId> --source local --output ./runs
```

## Count rows

```bash theme={null}
octoparse data count <taskId> --source local
octoparse data count <taskId> --source cloud --unexported --json
```

## Preview rows

```bash theme={null}
octoparse data preview <taskId> --source local --limit 20
octoparse data preview <taskId> --source cloud --limit 20 --offset 0
octoparse data preview <taskId> --source cloud --unexported --json
```

Preview returns the latest rows unless `--offset` is provided. `--unexported` reads cloud unexported rows without marking them as exported.

## Export results

```bash theme={null}
octoparse data export <taskId> --source local --format xlsx
octoparse data export <taskId> --source cloud --format csv --file result.csv
octoparse data export <taskId> --source local --lot-id <lotId> --format json
```

Supported formats are `xlsx`, `csv`, `html`, `json`, and `xml`.

If `--format` is omitted, the CLI uses `xlsx` unless it can infer a format from `--file`. If `--file` is omitted, it creates `task-name.<format>` without overwriting an existing file.

## Local output directories

Keep the run, history, and export paths consistent:

```bash theme={null}
octoparse run <taskId> --detach --output ./runs
octoparse data history <taskId> --source local --output ./runs
octoparse data export <taskId> --source local --output ./runs --format xlsx
```

See [Troubleshooting](../reference/troubleshooting#export-errors) for empty files and unsupported formats.
