# 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 mechanism could state how many lines per file (`linesPerFile`) and how many files per folder (`filesPerFolder`).
* Specifically for this command, `datasaur` and `projectState` attributes won't be needed on the configuration since there is no API call, that's why the explanation below only consist of `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

Specify the file location that will be split. Currently, Robosaur can only process a file that is located on your device.

#### Result Folder

The result of split files will be placed to this folder. Currently, Robosaur can only put the result files on a folder that is located 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

Whether the CSV file has a header or not.

#### Files Per Folder <a href="#execution-modes" id="execution-modes"></a>

The reason for this attribute is to make the split result compatible with [project creation command](/integrations/robosaur/commands/create-projects.md) as the input so that you can combine these two commands. Each folder inside the result will be treated as a project and each files inside every folder will be treated as the documents.

#### Lines Per File <a href="#execution-modes" id="execution-modes"></a>

The number of lines each file will have before Robosaur creates another split file.


---

# Agent Instructions: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
