> 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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.datasaur.ai/integrations/robosaur/commands/split-document.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
