# onFileImport

The event occurs when an file was selected on a fileImport control. The import function will detect if the file is using a comma or a semicolon as separator. Brixxbox will therefore count the occurrences of commas and semicolons in the first line (Header) and will use the higher counted char as separator.

You can access eventArgs.details inside this event to get the file content and meta data:

* eventArgs.details.csvLines - Array of all lines splitted by csv rules
* eventArgs.details.lines - Array of all lines splitted by csv rules
* eventArgs.details.fileExtension - extension of the import file ("csv" for example)
* eventArgs.details.fileExtensionLower - extension of the import file in lowercase
* eventArgs.details.fileInfo - a javascript [file info object](https://developer.mozilla.org/de/docs/Web/API/File)
* eventArgs.details.fileName - the file name
* eventArgs.details.fileNameLower - the file name in lowercase
* eventArgs.details.fileNameFull - the file name with extension
* eventArgs.details.fileNameFullLower - the file name with extension in lowercase
* eventArgs.details.rawData - the whole file content as a single text
* eventArgs.details.rawLines - an array of all the lines. Use this if you want to split the lines following your own rules

```javascript
for(let i = 0; i < eventArgs.details.lines.length; i++){
    console.log(`This is line ${i} with name: ${eventArgs.details.lines[i].myNameField}`);
}
```


---

# 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://brixxbox.gitbook.io/brixxbox-documentation/client-api-reference/events/onfileimport.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.
