IMD SolutionComputing LibraryShop main store

Comparison

Reading a CSV file into VTScada: DDE, XML or ODBC paths

Edge computing and IIoT Published 7 min read

Short answer

A constantly updating CSV reaches VTScada fastest through Excel and the DDE client driver, using the Data > From Text/CSV import and R1C1 cell addressing. Those values reach the historian only if the receiving tags have logging enabled, and they arrive as snapshots of the newest value, not as the file's rows. A local JSON or XML service removes the Excel dependency, while backfilling the file's own timestamps needs a separate historical import.

On this page
  1. The three paths compared
  2. What it takes for the historian to store the values
  3. Setting up the Excel and DDE path
  4. Why a good screen value can still miss records
  5. Worked example: an appending CSV at five-second intervals
  6. Replacing Excel with a JSON or XML service
  7. Where ODBC earns its place
  8. The decision for each case
  9. Questions asked

Yes, a constantly updating CSV can be read into VTScada, and the shortest working route is Excel plus the DDE client driver: import the file with Data > From Text/CSV, address the cells in R1C1 style, and read them as tags. Those tags store history only when their logging is enabled, and they carry snapshots of the newest value, not the file's rows. When Excel must leave the chain, a small local service publishing JSON or XML feeds the JSON/XML driver instead, and ODBC earns its place only when the records already live in a database. The sections below give each path's requirements, a worked example of how much a fast-updating file survives, and the decision for each case.

The three paths compared #

Path What sits between the CSV and VTScada Choose it when Main weakness
Excel plus DDE client driver An Excel workbook holding a refreshed import of the file You need the latest value now and Excel can stay running Depends on a desktop application; whole-minute refresh; no per-row history
Local service plus JSON/XML driver A service you write that parses the file and publishes fields Excel must go, or you want explicit units and freshness in the payload You build, host and monitor the service
Database plus ODBC driver The producer or a scheduled loader writes the rows to a table The records belong in a database anyway and you want query-selected rows An extra database in the chain; a plain CSV file does not speak ODBC

The first two rows turn the file's newest value into live tags. None of the three imports the file's rows into the historian with their original timestamps; that is a separate job, covered at the end.

What it takes for the historian to store the values #

Live acquisition and history are two independent settings. A tag fed by any driver shows its current value whether or not it is logged; rows appear in the historian only when logging is enabled on that tag and its trigger condition, a deadband or a period, is met. A tag that logs on change writes nothing new while its value sits still, so a flat trend can be correct history of a steady signal rather than a fault.

Check quality as well as value. A driver can hand the tag its last value with bad quality when the source stops responding, and a display will still draw that number. Before any tag on this path drives an alarm or a setpoint, test its quality and staleness in logic, because a frozen cell looks exactly like a steady process value.

Setting up the Excel and DDE path #

  1. Import the file into the workbook with Data > From Text/CSV. Check the delimiters and confirm the numeric columns arrived as numbers, not text.
  2. Switch the workbook to R1C1 reference style. The DDE item addressing used here reads cells as R1C1 rather than the default A1 references, and a mismatch reads nothing.
  3. Give the import a refresh that follows the file. Excel's built-in periodic refresh is set in whole minutes, so one minute is the fastest it offers; a macro on a timer can refresh faster but adds code you now maintain.
  4. Enable DDE on the VTScada side. From VTScada 12.0 onward, DDE is enabled by launching the application with the /D switch.
  5. Create the communication channel with the DDE client driver. The driver is chosen when the channel is created and shows afterwards as a read-only property on that channel.
  6. Create the tags addressed to the workbook, worksheet and cell. Verify each raw value against the cell before applying any scaling.
  7. Enable historian logging on the receiving tags and bind the displays to those tags, then test after a restart under the intended operating account, not only while an engineer has the workbook open interactively.

Keep the worksheet name, column order and file path stable. A renamed sheet or an inserted column redirects the read silently.

Why a good screen value can still miss records #

The chain has distinct stages: the producer writes the file, Excel refreshes its import, DDE reads a cell, the tag updates, and the historian logs according to the tag's configuration. Any stage can stall while the others look healthy. Excel can hold a stale import while the file moves on, and DDE will keep reading that stale cell, so the screen shows a plausible value with nothing to flag the missed refresh.

A single cell is a snapshot. If the producer updates the measurement faster than the whole chain cycles, the intermediate values are gone before VTScada ever sees them. An append-only file adds a second trap: a fixed cell address keeps pointing at the same row unless the workbook deliberately selects the newest record. And there is no controller in this chain, so do not chase a PLC communications fault; a display bound to the wrong tag is a binding problem, and a correctly bound tag with a stale source is a data-path problem.

Worked example: an appending CSV at five-second intervals #

This is a hypothetical example with stated inputs, not a measurement. Suppose the producer appends one row every 5 s, and the workbook uses Excel's fastest built-in refresh of one minute.

  • Rows the file gains in one hour: 3600 s divided by 5 s = 720 rows.
  • Reads the chain performs in that hour: 3600 s divided by 60 s = 60 reads.
  • Fraction of rows VTScada ever sees: 60 divided by 720 = 0.083, so about 8 %.
  • Rows never read: 720 minus 60 = 660, which is 660 divided by 720 = 0.917, about 92 %.

The decision from that arithmetic: if only the latest value matters, the path is fine. If every record matters, either slow the producer below the read rate, refresh faster with a service that polls on a short period, or run a historical import of the file's rows.

Replacing Excel with a JSON or XML service #

A service on the plant network reads the CSV, selects the newest complete record, and publishes the values as JSON or XML that the VTScada JSON/XML driver polls. The same driver is a general reader for third-party endpoints, not just your service: it has been used to pull published weather data over XML and raise alarms on the result, which shows the pattern of acquiring an outside feed into ordinary tags.

Design the payload deliberately:

  • Publish the value, its engineering unit and a freshness indicator, such as the source record number or timestamp, as separate fields.
  • Read only complete records. Detect a half-rewritten file and skip it rather than publishing a truncated row as good data.
  • Validate numeric fields and select the newest record before building the output.
  • Test a missing file, a malformed record and a stopped service separately from the successful read, and decide whether the last valid value is republished or the quality drops.

Republishing the last value preserves display continuity but hides a stopped producer, so prefer dropping quality and alarming on it. The driver also writes outward: sending data through a JSON/XML driver tag requires a processor module that defines the payload, covered in configuring VTScada tag writes through the JSON/XML driver.

Where ODBC earns its place #

The ODBC driver reads a database through a configured connection and a query. A CSV file contributes nothing here until its rows exist in a table, so either the producer writes to the database directly or a scheduled loader appends the file's rows. Once they are there, the query does the selection work, such as the newest row or the rows since the last read, which is more control than a fixed cell address gives you.

Choose ODBC when a database already exists in this data flow, or is wanted for reporting anyway. Do not stand up a database server solely to carry one CSV file from one producer to one SCADA host; the JSON or XML service is the lighter intermediate.

The decision for each case #

  • Latest live value, Excel available, and staleness of up to one minute acceptable: Excel plus the DDE client driver. Set the import refresh, switch to R1C1, launch VTScada with the /D switch on current versions, and enable logging on the tags.
  • No Excel in the budget or on an unattended host, or you need a refresh faster than one minute and explicit freshness: write or buy a small service and read it with the JSON/XML driver. You take on the service's monitoring.
  • The records already live in, or are headed for, a database: read them with the ODBC driver and let the query select what arrives.
  • Complete history with the file's own timestamps: none of the three live paths delivers it. Run a historical import that accepts an explicit time per record, alongside whichever live path you chose.

Questions asked

Can VTScada read a plain CSV file with no Excel, service or database in between?

No. None of the drivers parses a delimited text file directly. The file has to be exposed through DDE by another application, converted to JSON or XML by a service, or loaded into a database table first. Something always sits between the file and the tag, and that intermediate component is what you maintain.

Why does the DDE connection fail while Excel is clearly open?

The DDE client needs a responding DDE server, not merely a running application. The workbook the driver addresses must be open under the exact topic name the driver uses, and current Excel security settings can suppress DDE exchanges entirely. Test the link from the driver's diagnostics before changing the VTScada configuration.

The tag updates but the trend shows a flat line. Is history being lost?

If the tag logs on change, a steady value writes no new rows and the flat line is correct history. If the source is genuinely moving, compare the tag's timestamp against the workbook's last refresh time and the CSV's newest record; whichever of the three is oldest is the stalled stage.

Can the timestamps in the CSV become the historian's record times?

Not through DDE, and not through the live JSON, XML or ODBC reads; those store the value at the time it arrives. Preserving the file's own timestamps needs a historical import that accepts an explicit time for each record, run as a separate job from the live acquisition.

Keep reading

  • Troubleshooting

    Historian reads slow in Excel after adding tags

    Run one timed test before touching anything: read one old tag and one newly added tag over the same range in the historian's built-in client, then in the Excel macro. Fast in the client but slow in Excel means the macro's request pattern is the fault; the new tag slow in both means you run the historian's validate action and then confirm the SQL maintenance plan actually targets the historian database.

    Edge computing and IIoT

  • Troubleshooting

    Reading default historian data in SQL Server the supported way

    Attaching a SQL Server DSN to the SystemHistorian tag does store the historian's tables in SQL Server, but they are keyed to internal tag IDs, not tag names. Keep the default historian as the store and read the data through the REST SQLQuery endpoint, building an ID-to-name lookup from the Parms tables and paging large ranges in blocks of about ten thousand records.

    Edge computing and IIoT

  • How-to

    Retrieve manually inserted historian values into InTouch tags

    Manual-acquisition tags are stored by the Historian but never pass the runtime window that the InTouch access name aahiosvrsvc serves, so the live-value connection returns nothing. Retrieve the newest sample of each tag with a windowed SQL query against the Runtime history view, then assign each row to its InTouch tag by TagName in script.

    Edge computing and IIoT