> For the complete documentation index, see [llms.txt](https://docs.datasaur.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.datasaur.ai/integrations/robosaur/commands/split-document.md).

# Split Document

## How it works

```bash
$ npm run start -- split-document -h
Usage: robosaur split-document [options] <configFile>

Split document into multiple projects

Options:
  -h, --help  display help for command
```

Robosaur can split a file based on the configuration. The split behavior can be configured using:

* `linesPerFile`: Number of lines in each split file.
* `filesPerFolder`: Number of files in each output folder.

Unlike other commands, `datasaur` and `projectState` are not required for this command because it does not make any API calls. As a result, the configuration for this command only requires the `splitDocument` attribute.

## Configuration

```json
{
  "splitDocument": {
    "path": "<path-to-a-file-that-will-be-split>",
    "header": true,
    "linesPerFile": 100,
    "filesPerFolder": 10,
    "resultFolder": "<path-to-all-split-files-result>"
  }
}
```

#### Path

`path` specifies the file to split. Currently, Robosaur only supports files stored locally on your device.

#### Result folder

`resultFolder` specifies where the split files will be saved. Currently, Robosaur only supports saving results to a local directory on your device.

The result will be compatible with project creation input. The result folder will be created if it doesn't exist and will be emptied if it already exists.

#### Header

`header` defines whether the CSV file contains a header row.

#### Files per folder <a href="#execution-modes" id="execution-modes"></a>

`filesPerFolder` defines how many split files are placed in each folder. This setting helps make the output compatible with the `create-projects` command.

* Each folder is treated as a project.
* Each file inside a folder is treated as a document.

#### Lines per file <a href="#execution-modes" id="execution-modes"></a>

`linesPerFile` defines how many lines each split file contains before Robosaur creates the next file.
