---
title: How to create a CSV driver using the Alleantia Driver Editor
description: Using the Web Driver Editor to create a driver for machines using CSV files for data input and output.
---

[Skip to content](https://kb.alleantia.com/create-driver-csv#main-content)

English

Show submenu for translations

![Alleantia\_ATJ\_whitelogocolorbandtrasnpbg\_HR-Oct-21-2021-02-02-26-19-PM.png\]](https://kb.alleantia.com/hs-fs/hubfs/Alleantia_ATJ_whitelogocolorbandtrasnpbg_HR-Oct-21-2021-02-02-26-19-PM.png?height=40&name=Alleantia_ATJ_whitelogocolorbandtrasnpbg_HR-Oct-21-2021-02-02-26-19-PM.png)

Open main navigation

Close main navigation

- English
  
  Show submenu for translations
- [Visit our site](https://www.alleantia.com/)

[Visit our site](https://www.alleantia.com/)

 Welcome to Alleantia, Industrial IoT Edge Gateway. How can we help you?

- There are no suggestions because the search field is empty.

1. [Alleantia Knowledge Base](https://kb.alleantia.com/)
2. [Machine Drivers](https://kb.alleantia.com/machine-drivers)
3. [How can I create a driver with Driver Editor?](https://kb.alleantia.com/machine-drivers#how-can-i-create-a-driver-with-driver-editor)

# How to create a CSV driver using the Alleantia Driver Editor

## Using the web Driver Editor to create a driver for machines using CSV files for data input and output.

### Reading mode

Before starting the creation of a CSV driver, it's important to consider the type of reading you intend to perform on the file. This depends on the machine setup. It can be one of:

- **Reading a single row at a time (the machine creates a single file in 'append' mode).**
- **Reading multiple rows at the same time (the machine creates one file at a time with multiple rows).**

### **Case 1: Reading a single row at a time (append mode)**

We have a machine that adds to the output file a row every time the machine finishes processing, with the process output information. The output file is the same for all outputs (it may change once a day or more, but not depending on the production process).

In this sample case, there are 4 parameters (from left to right): Timestamp, par1, par2, status, all separated by a comma (,).

![](https://kb.alleantia.com/hs-fs/hubfs/image-png-Feb-27-2024-01-48-05-8802-PM.png?width=667&height=258&name=image-png-Feb-27-2024-01-48-05-8802-PM.png)

The command used to navigate a single-row files that must to be inserted in the driver editor is:

**allfile.split(&quot;\\n&quot;)\[allfile.split(&quot;\\n&quot;).length-1\].split(&quot;,&quot;)\[x\]**

Note: "&quot;" is used instead of double quotes " ", where (&quot;\\n&quot;) means: (“\\n”)

\`allfile.split(&quot;\\n&quot;)\` means: split the file every time you see a newline character (\\n), and with \`\[allfile.split(&quot;\\n&quot;).length-1\]\`, we indicate which "row" to point to. In this case, we use length-1 because a new row is added each time the machine updates the job status.

**![](https://kb.alleantia.com/hs-fs/hubfs/image-png-Feb-27-2024-01-48-27-5185-PM.png?width=587&height=344&name=image-png-Feb-27-2024-01-48-27-5185-PM.png)**

 

**\`split(&quot;,&quot;)\[x\]\`** allows us to move within the row identified by the previous command. Inside the parenthesis, we define how the parameters in the row are separated; in this case, it's the comma ",". In the square brackets, we indicate the position from which we want to acquire the data

![](https://kb.alleantia.com/hs-fs/hubfs/image-png-Feb-27-2024-01-49-05-1950-PM.png?width=602&height=369&name=image-png-Feb-27-2024-01-49-05-1950-PM.png)

For example:

for the variable Timestamp we will use the following command:

**allfile.split(&quot;\\n&quot;)\[allfile.split(&quot;\\n&quot;).length-1\].split(&quot;,&quot;)\[0\]**

For the variable Status:

 **allfile.split(&quot;\\n&quot;)\[allfile.split(&quot;\\n&quot;).length-1\].split(&quot;,&quot;)\[3\]**

#### **Mapping variables through the Alleantia Web Editor:**

#### **Variable mapping sample:**

**![](https://kb.alleantia.com/hs-fs/hubfs/image-png-Mar-08-2024-04-14-43-6502-PM.png?width=688&height=153&name=image-png-Mar-08-2024-04-14-43-6502-PM.png)**

**Variable Timestamp:**

\- In the "Name" field: Timestamp.

\- In the "Command" field: \`allfile.split(&quot;\\n&quot;)\[allfile.split(&quot;\\n&quot;).length-1\].split(&quot;,&quot;)\[1\]\`.

\- In the "Data Type" field: String.

**Variable par1:**

\- In the "Name" field: par1.

\- In the "Command" field: \`allfile.split(&quot;\\n&quot;)\[allfile.split(&quot;\\n&quot;).length-1\].split(&quot;,&quot;)\[1\]\`.

\- In the "Data Type" field: Numeric.

**Variable par2:**

\- In the "Name" field: par2.

\- In the "Command" field: \`allfile.split(&quot;\\n&quot;)\[allfile.split(&quot;\\n&quot;).length-1\].split(&quot;,&quot;)\[1\]\`.

\- In the "Data Type" field: Numeric.

**Variable Total Status:**

\- In the "Name" field: Total Status.

\- In the "Command" field: \`allfile.split(&quot;\\n&quot;)\[allfile.split(&quot;\\n&quot;).length-1\].split(&quot;,&quot;)\[\]\`.

\- In the "Data Type" field: String.

Note: You can concatenate multiple separators and use different commas in the same driver.

### **Case 2: Reading multiple rows at the same time **

In this case, we have a machine that generates a new file with several rows upon completing the operational process (e.g., recording processes over a longer period than the actual execution).

In the following sample file, there are 5 parameters: Status, Table, Operator, TotalPieces, GoodPieces.

![](https://kb.alleantia.com/hs-fs/hubfs/image-png-Feb-27-2024-02-05-40-8587-PM.png?width=281&height=222&name=image-png-Feb-27-2024-02-05-40-8587-PM.png)

We have the variable name followed by the "=" sign and the corresponding value, which will be the parameter of our interest to map.

Since the machine generates a new file each time, the position of the rows from which to extract the values will always be the same. We will use the following command:

**allfile.split(&quot;\\n&quot;)\[allfile.split(&quot;\\n&quot;).\[y\].split(&quot;=&quot;)\[x\]**

NOTE: **&quot;** is used instead of double quotes " ", where (**&quot;**\\n**&quot;**) means: (“\\n”),

and .\[y\] specifies the row to read (y=0, y=1...).

For example, the command for the Status variable,  will be:

**                 allfile.split(&quot;\\n&quot;)\[allfile.split(&quot;\\n&quot;).\[1\].split(&quot;=&quot;)\[1\]**

For the Table variable:

**                 allfile.split(&quot;\\n&quot;)\[allfile.split(&quot;\\n&quot;).\[2\].split(&quot;=&quot;)\[1\]**

#### **Mapping variables through the Alleantia Web Editor:**

![](https://kb.alleantia.com/hs-fs/hubfs/image-png-Mar-08-2024-02-20-00-8215-PM.png?width=674&height=195&name=image-png-Mar-08-2024-02-20-00-8215-PM.png)

**Variable Status:**

\- In the "Name" field: Status.

\- In the "Command" field: \`allfile.split(&quot;\\n&quot;)\[1\].split(&quot;,&quot;)\[1\]\`.

\- In the "Data Type" field: String.

**Variable Table:**

\- In the "Name" field: Table.

\- In the "Command" field: \`allfile.split(&quot;\\n&quot;)\[2\].split(&quot;,&quot;)\[1\]\`.

\- In the "Data Type" field: String.

**Variable Operator:**

\- In the "Name" field: Operator.

\- In the "Command" field: \`allfile.split(&quot;\\n&quot;)\[3\].split(&quot;,&quot;)\[1\]\`.

\- In the "Data Type" field: String.

**Variable Total Pieces:**

\- In the "Name" field: Total Pieces.

\- In the "Command" field: \`allfile.split(&quot;\\n&quot;)\[4\].split(&quot;,&quot;)\[1\]\`.

\- In the "Data Type" field: Numeric.

**Variable Good Pieces:**

\- In the "Name" field: Total Pieces.

\- In the "Command" field: \`allfile.split(&quot;\\n&quot;)\[5\].split(&quot;,&quot;)\[1\]\`.

\- In the "Data Type" field: Numeric.

Note: You can concatenate multiple separators and use different commas in the same driver.

### **Writing Mode**

Writing through the File driver is possible using a Template, which is a CSV file structured like the machine input file. Values will be replaced by placeholders %s at the time of writing.

![](https://kb.alleantia.com/hs-fs/hubfs/image-png-Feb-27-2024-02-07-44-9664-PM.png?width=301&height=246&name=image-png-Feb-27-2024-02-07-44-9664-PM.png)

In addition to the Template, two variables are needed: "FILENAME" and the "TRIGGER" variable.

![](https://kb.alleantia.com/hs-fs/hubfs/image-png-Mar-08-2024-03-57-08-5220-PM.png?width=666&height=283&name=image-png-Mar-08-2024-03-57-08-5220-PM.png)

To add a writing variable, click the "+" button under "Variables."

**Variable Status:**

\- In the "Name" field: S\_Status.

\- In the "Data Type" field: String.

 \- In the "Access Type" field: Writing.

**Variable Table:**

\- In the "Name" field: S\_Table.

\- In the "Data Type" field: String.

\- In the "Access Type" field: Writing.

**Variable Operator:**

\- In the "Name" field: S\_Operator.

\- In the "Data Type" field: String.

\- In the "Access Type" field: Writing.

**Variable Total Pieces:**

\- In the "Name" field: S\_Total Pieces.

\- In the "Data Type" field: Numeric.

\- In the "Access Type" field: Writing.

**Variable Good Pieces:**

\- In the "Name" field: S\_Total Pieces.

\- In the "Data Type" field: Numeric.

\- In the "Access Type" field: Writing.

**Variable TRIGGER **

\- In the "Name" field: TRIGGER.

\- Set "Access Type" to write.

\- In "XML Type," put "ROOT".  

**Variable FILENAME **

\- In the "Name" field: FILENAME .

\- Set "Access Type" to write.

\- In "XML Type," put "NAMEFILE". 

- [Industrial IoT Connectivity in 4 steps](https://kb.alleantia.com/industrial-iot-connectivity-in-4-steps#main-content)

    - [Industrial Connectivity in 5 minutes - Configuration Steps](https://kb.alleantia.com/industrial-iot-connectivity-in-4-steps#industrial-connectivity-in-5-minutes-configuration-steps)
- [Alleantia Platform Overview](https://kb.alleantia.com/alleantia-platform-overview#main-content)

    - [Alleantia Core](https://kb.alleantia.com/alleantia-platform-overview#alleantia-core)
    - [Cloud Portal](https://kb.alleantia.com/alleantia-platform-overview#cloud-portal)
    - [Machine Drivers](https://kb.alleantia.com/alleantia-platform-overview#machine-drivers)
    - [IIoT Apps - Connect Business Apps](https://kb.alleantia.com/alleantia-platform-overview#iiot-apps-connect-business-apps)
    - [Site Manager](https://kb.alleantia.com/alleantia-platform-overview#site-manager)
- [Alleantia Core](https://kb.alleantia.com/alleantia-core#main-content)

    - [Alleantia Core - Download and Configurations](https://kb.alleantia.com/alleantia-core#alleantia-core-download-and-configurations)
- [Licenses and Free Version](https://kb.alleantia.com/licenses-and-free-version#main-content)

    - [License Management](https://kb.alleantia.com/licenses-and-free-version#license-management)
    - [Alleantia Core - Free Version](https://kb.alleantia.com/licenses-and-free-version#alleantia-core-free-version)
- [Machine Drivers](https://kb.alleantia.com/machine-drivers#main-content)

    - [How can I create a driver with spreadsheet template??](https://kb.alleantia.com/machine-drivers#how-can-i-create-a-driver-with-spreadsheet-template)
    - [How can I create a driver with Driver Editor?](https://kb.alleantia.com/machine-drivers#how-can-i-create-a-driver-with-driver-editor)
    - [Private Library](https://kb.alleantia.com/machine-drivers#private-library)
    - [Machines connection configurations](https://kb.alleantia.com/machine-drivers#machines-connection-configurations)
- [Stream Data - IIoT Apps](https://kb.alleantia.com/stream-data-iiot-apps#main-content)

    - [API REST](https://kb.alleantia.com/stream-data-iiot-apps#api-rest)
    - [Modbus](https://kb.alleantia.com/stream-data-iiot-apps#modbus)
    - [OPC UA](https://kb.alleantia.com/stream-data-iiot-apps#opc-ua)
    - [AWS](https://kb.alleantia.com/stream-data-iiot-apps#aws)
    - [Boomi](https://kb.alleantia.com/stream-data-iiot-apps#boomi)
    - [Microsoft Azure](https://kb.alleantia.com/stream-data-iiot-apps#microsoft-azure)
    - [Dropbox](https://kb.alleantia.com/stream-data-iiot-apps#dropbox)
    - [MQTT](https://kb.alleantia.com/stream-data-iiot-apps#mqtt)
    - [SQL](https://kb.alleantia.com/stream-data-iiot-apps#sql)
    - [OneDrive for Business](https://kb.alleantia.com/stream-data-iiot-apps#onedrive-for-business)
    - [TeamViewer](https://kb.alleantia.com/stream-data-iiot-apps#teamviewer)
- [Alleantia Certified Hardware](https://kb.alleantia.com/alleantia-certified-hardware#main-content)

    - [Advantech](https://kb.alleantia.com/alleantia-certified-hardware#advantech)
    - [Cisco](https://kb.alleantia.com/alleantia-certified-hardware#cisco)
    - [Dell](https://kb.alleantia.com/alleantia-certified-hardware#dell)
    - [Eurotech](https://kb.alleantia.com/alleantia-certified-hardware#eurotech)
    - [Lenovo](https://kb.alleantia.com/alleantia-certified-hardware#lenovo)
    - [Portwell](https://kb.alleantia.com/alleantia-certified-hardware#portwell)
    - [Stratus](https://kb.alleantia.com/alleantia-certified-hardware#stratus)
- [Simulators and Starter Kit Industria 4.0](https://kb.alleantia.com/simulators-and-starter-kit-industria-4-0#main-content)

    - [Simulators - PLCs, CNC, Energy meters](https://kb.alleantia.com/simulators-and-starter-kit-industria-4-0#simulators-plcs-cnc-energy-meters)
    - [Starter Kit Industria 4.0](https://kb.alleantia.com/simulators-and-starter-kit-industria-4-0#starter-kit-industria-4-0)
- [Edge Operational Applications](https://kb.alleantia.com/edge-operational-applications#main-content)

    - [Cobot Smart Service](https://kb.alleantia.com/edge-operational-applications#cobot-smart-service)
- [FAQs - Trouble Shooting](https://kb.alleantia.com/faqs-trouble-shooting#main-content)

    - [Configurations](https://kb.alleantia.com/faqs-trouble-shooting#configurations)
    - [System Setup](https://kb.alleantia.com/faqs-trouble-shooting#system-setup)
    - [Interfaces to IIoT Apps](https://kb.alleantia.com/faqs-trouble-shooting#interfaces-to-iiot-apps)
    - [Interfaces to Industrial Devices](https://kb.alleantia.com/faqs-trouble-shooting#interfaces-to-industrial-devices)
- [Connectivity](https://kb.alleantia.com/connectivity)

[![Chill listening crop-3](https://kb.alleantia.com/hs-fs/hubfs/Alleantia_ATJ_transpbg_HD-1.jpg?width=120&height=55&name=Alleantia_ATJ_transpbg_HD-1.jpg "Chill listening crop-3")](http://www.alleantia.com)

© 2024 Alleantia s.r.l

<https://www.linkedin.com/company/2293482/admin/> <https://twitter.com/Alleantiasrl> <https://www.facebook.com/Alleantia>

Copyright © 2026, ALLEANTIA SRL