Connecting to a CSV data file

You want to use the data of a CSV file in cablabel S3 Pro? Here are the main steps to configure this specific connection.

Attention: Microsoft Office associates for example the CSV files with Excel, although it is not the same format as XLS or XLSX files. For this reason, it is not possible to use in cablabel S3 Pro an Excel connection to connect to a CSV file.

  1. Prepare the host directory of the CSV file

Define the folder hosting the CSV file, then copy or create the “schema.ini” file in this same folder.

Host directory

The “schema.ini” file, which can be modified with a text editor, contains the structure of the CSV data file and must always remain in the same folder as this one.

schema.ini
  • [filename.csv] ⇒ Name and extension of the data file.
  • ColNameHeader ⇒ “True” or “False” to indicate whether or not the 1st row of data contains the column names.
  • Format ⇒ Character that delimits the columns. For example “TabDelimited” for the tab character, “CSVDelimited” for the comma or “Delimited(;)” for any other character except double quotation marks (").
  • MaxScanRows ⇒ Number of rows to scan to determine the column types, with “0” to scan the whole file.
  • CharacterSet ⇒ Encoding of the CSV file. For example “ANSI” by default or “65001” for UTF-8.
  • Coln ⇒ Name of column “n” as well as the type and the length of its data. For cablabel S3 Pro, raw data in text form should be preferred.
  1. Configure the ODBC Data Source Administrator in Windows

Start the tool “C:\Windows\SysWOW64\odbcad32.exe” for Windows in 64-bit or “C:\Windows\System32\odbcad32.exe” for Windows in 32-bit.

odbcad32.exe

Then add a new “System Data Source” and select the driver “Microsoft Text Driver (*.txt ; *.csv)”.

ODBC Data Source Administrator
  • Data Source Name ⇒ Enter a free name.
  • Description ⇒ Optional.
  • Directory ⇒ Uncheck “Use Current Directory” and “Select Directory” prepared in step 1.
  1. Configure the connection string in cablabel S3 Pro

Add in the label an OLE DB connection and click on button “…” to start the connection string wizard.

Connection string

Then select the provider “Microsoft OLE DB Provider for ODBC Drivers” and use the data source configured in step 2.

Provider
Connection

Finally create the data query as usual. After that, the data from the CSV file can be used by the objects of the label.

Data query

Download example file for cablabel S3 Pro: