WinCC 6.2 User Archive: Importing CSV Files from Client to Server

David Krause13 min read
SCADA ConfigurationSiemensTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Overview

WinCC V6.2 (and the related WinCC V7.x line that shares the same User Archive engine) uses a SQL Server-backed User Archive database that physically resides on the WinCC server. In a multi-client configuration—where the runtime database, the archive database, and the project itself all live on the server—clients can read and write user archive rows over the WinCC connectivity layer, but they cannot directly push an exported .csv file back into the server's SQL store. The file must first be transferred to the server's local filesystem (or to a network share the server can resolve), and then loaded through the User Archive import function, the UserArchiveControl OLE/COM interface, or a WinCC C / VBScript that calls the same interface.

This article documents the practical transfer path between a WinCC client (e.g. CPU2, CPU3, CPU4 in a 1-server / 3-client topology) and the WinCC server, and the three reliable mechanisms for getting the CSV back into the user archive table.

Engineering note: In a WinCC multi-user system, the user archive database is opened exclusively by the WinCC Server service. The SQL Server instance used by User Archive is the one that ships with the WinCC Server installation (default instance name WinCC on a separate SQL Server Express, or a named instance for full SQL). Clients do not open the database directly—they read rows through the WinCC channel and write rows through the same channel.

Prerequisites

  • WinCC V6.2 SP2 or later installed on the server (and matching RT version on the client). For V6.2 + HF7 or later, the "User Archive" option must be licensed on the server.
  • SQL Server 2005 (default with V6.2) or SQL Server 2008 (V6.2 SP3) on the server, running and configured with the CC_UASys_<ProjectName> database for user archives.
  • User Archive configured in WinCC Explorer on the server: archive name, columns, connection, primary key, and (if the archive is to be shared) a read/write column permission set for the WinCC client user group.
  • Windows domain or workgroup trust between server and client so that the WinCC client service account can read/write the file share used for CSV staging.
  • Network share (or local path) accessible from both the client and the server, with NTFS write permission for the client service account and read permission for the WinCC Server service account.

WinCC User Archive Server-Client Architecture

WinCC User Archive is a runtime database that consists of three logical components:

  1. Configuration database – stored in the WinCC project directory <Project>\<Computer>\UACSconfig. Defines archive structure, field types, and connections.
  2. Runtime database – the SQL Server instance that holds the actual row data. On the server this is CC_UASys_<ProjectName>; clients do not have a runtime database for the archive.
  3. Connectivity layer – WinCC channel DLL "User Archive" that exposes ua_read / ua_write to WinCC tag management and to C / VBScript via the UserArchiveControl automation interface.

In a 1-server, 3-client system, the runtime files that the user sees when they click Export in the User Archive editor or via UACExport are written on whichever computer invokes the export. By default WinCC V6.2 stores the export in the project's runtime directory, but for a client this resolves to the client's local path (e.g. C:\). The file never appears on the server unless you explicitly redirect the export target or transfer the file.

Where the export actually lands: The path is determined by the Export field in the User Archive connection properties. If you leave it blank, WinCC uses %TEMP% on the executing computer. If you set it to a UNC path such as \\<server>\WinCC_UA_Staging, the file lands on the server directly—but the WinCC client service account must have write permission to that share.

CSV Export Path Configuration on the Client

To make the round trip work, configure the export path on the client so that the CSV lands in a directory that the server can read. There are two practical patterns.

Pattern A — UNC path to a server share

  1. On the WinCC server, create a folder such as D:\WinCC_UA_Staging and share it as WinCC_UA_Staging$ (hidden) or as WinCC_UA_Staging with read/write for the WinCC group.
  2. On each client, in WinCC Explorer, open User Archive, right-click the archive, choose Properties, and on the Connection tab set the export directory to \\<server>\WinCC_UA_Staging.
  3. Run the project on the client. Clicking Export (or invoking the export from a button) writes the CSV into the server share.

Pattern B — Local client path, transferred afterward

  1. On each client, configure the export to a known local path such as C:\WinCC_UA_Export.
  2. Transfer the file to the server by one of the methods in the next section.

Method 1 — Map a Network Drive and Copy Manually

This is the most direct method and the one most field engineers reach for first.

  1. On the client, open Windows Explorer, right-click This PC, choose Map network drive.
  2. Drive letter: S:. Folder: \\<server>\WinCC_UA_Staging. Tick Reconnect at sign-in only if the client uses a service account that persists across reboots.
  3. Click Finish. Provide credentials of a Windows user that has write permission on the share.
  4. Browse to C:\WinCC_UA_Export, copy the CSV, paste it into S:\.
  5. On the server, the file is now available for import into the user archive.

This method is appropriate for one-off transfers or for engineers debugging a configuration. For automated round-trip on a button press in the WinCC runtime, use Method 2 or 3.

Method 2 — Server-Side Import Using the User Archive Editor

Once the CSV is on the server, import it through the User Archive editor in WinCC Explorer on the server.

  1. On the server, open WinCC Explorer and activate the project if it is not already running (or open it in configuration mode for offline import).
  2. Right-click the user archive, choose Import, and select the CSV file from the staging directory.
  3. Map CSV columns to archive fields in the dialog that appears. WinCC reads the first row as field names by default; ensure they match the archive field names or map them explicitly.
  4. Choose the import mode:
    • Append – adds rows; duplicates by primary key are rejected.
    • Overwrite – replaces existing rows whose primary key matches.
    • Update – updates only the fields present in the CSV, leaves the rest untouched.
  5. Click OK and confirm the row count in the status line.
Field separator: The default separator for WinCC V6.2 user archive export is the locale-specific list separator (comma on English systems). If your project runs on a German locale, the separator will be a semicolon. Match the import separator to the export separator or set it explicitly in the import dialog.

Method 3 — Scripted Import via UserArchiveControl

For runtime-driven import (operator clicks a button, or a scheduled task runs the import), use the WinCC User Archive automation interface. The relevant methods are exposed through the UserArchiveControl COM object.

VBScript runtime action on a button

' WinCC VBScript — import a CSV from a known UNC path
Dim sFile
sFile = "\\SERVER01\WinCC_UA_Staging\UA_Batch_001.csv"

' Use the WinCC User Archive control's ConnectToServer and ConnectToArchive
Dim uaCtrl, uaArchive, uaConnection
Set uaCtrl = ScreenItems("UACtl")

uaCtrl.ConnectToServer "SERVER01\WinCC"
uaCtrl.ConnectToArchive "UA_Batch"

' uaCtrl.Import reads the file and writes into the connected archive
uaCtrl.Import sFile, 1  ' 1 = import mode overwrite

Set uaCtrl = Nothing

Scheduled import via WinCC Global Script C action

/* WinCC C action — scheduled import every 60 s
   Compiled in Global Script > Actions > Compile */
#include "apdefap.h"

void ImportUAFromUNC()
{
    LPCTSTR pszFile = TEXT("\\\\SERVER01\\WinCC_UA_Staging\\UA_Batch_001.csv");

    IUserArchive* pArchive = NULL;
    HRESULT hr = CoCreateInstance(CLSID_UserArchive, NULL, CLSCTX_INPROC_SERVER,
                                  IID_IUserArchive, (void**)&pArchive);
    if (FAILED(hr)) return;

    pArchive->lpVtbl->ConnectToServer(pArchive, TEXT("SERVER01\WinCC"));
    pArchive->lpVtbl->ConnectToArchive(pArchive, TEXT("UA_Batch"));
    pArchive->lpVtbl->Import(pArchive, pszFile, 1);

    pArchive->lpVtbl->Release(pArchive);
}

Both examples use the same server-side import logic; the difference is only where the code is hosted. Run the script on the server (or call it from a server-side Global Script action) so that the SQL write is local to the database.

Method 4 — Direct SQL Bulk Insert (Advanced)

If the CSV cannot go through the User Archive interface—for example, when the CSV contains columns that do not match the archive schema and you want to do server-side transformation—use bcp or a T-SQL BULK INSERT against the runtime database. This must be done on the server, with WinCC runtime stopped for the affected archive, because the User Archive engine holds a write lock on the table while the project is running.

-- Run on the server, with WinCC runtime paused for the UA_Batch archive
BULK INSERT [CC_UASys_MyProject].[dbo].[UA_Batch]
FROM 'D:\WinCC_UA_Staging\UA_Batch_001.csv'
WITH (
    FIELDTERMINATOR = ',',
    ROWTERMINATOR   = '\n',
    FIRSTROW        = 2,
    KEEPNULLS,
    TABLOCK
);
Locking warning: Stopping the WinCC runtime for a single archive is supported in WinCC V6.2 SP3 and later via the SIMATIC WinCC Archive Connector tool. Stopping only the affected user archive minimizes downtime. Avoid BULK INSERT while runtime is active—the User Archive engine will not see the new rows until its connection cache is refreshed, and concurrent writes from the runtime can corrupt the table.

Verification

After any of the import methods, verify the round trip end to end:

  1. In WinCC Explorer on the server, open the user archive table. Confirm the row count matches the source CSV's row count minus the header.
  2. Sort on the primary key column to confirm the import order or the overwrite behavior matches the selected mode.
  3. Open a client and add a User Archive table control to a screen. Confirm the rows are visible (if the project is running). If the client does not refresh, force a reconnect of the connectivity channel by toggling the WinCC Client service or by closing and re-opening the picture with the table control.
  4. Check the WinCC diagnostics window on the server: WinCC Explorer > Tools > Status of Connections. The user archive connection should show as Connected.
  5. Inspect the SQL log: SQL Server Management Studio > Management > SQL Server Logs. Look for any constraint violations on the user archive table that would indicate a partial import.

Configuration Parameters Reference

Parameter Location Typical value Notes
User Archive connection name Server > WinCC Explorer > User Archive > Connection UAServer Used by all clients over the connectivity channel.
SQL instance Server only WinCC / CC_UASys_<Project> Clients do not access SQL directly.
Export directory Archive properties > Connection > Export folder \\<server>\WinCC_UA_Staging UNC preferred over mapped drive letter.
Field separator Archive properties > Connection > Separator , or ; Matches OS locale list separator by default.
Import mode UserArchiveControl.Import / Editor Import dialog 0=append, 1=overwrite, 2=update Mode is per-call.
Client service account Windows > Services > SIMATIC WinCC Client Domain\svc_wincc_client Needs write permission on the staging share.
Server service account Windows > Services > SIMATIC WinCC Server Domain\svc_wincc_server Needs read on the share, write on the SQL DB.

Troubleshooting Matrix

Symptom Likely cause Diagnostic step Resolution
CSV lands on client C:\ even though export path is set to UNC Service account on the client cannot resolve the share (DNS, firewall, or share permissions) From the client, run cmd /c dir \\server\share under the same account that runs the WinCC Client service Fix DNS, open TCP 445, grant share/NTFS write
Import dialog shows 0 rows imported Field separator mismatch between export and import Open CSV in Notepad; check whether commas or semicolons are used Set separator explicitly in import dialog
UserArchiveControl.Import returns error -2147352567 Archive not connected; connectivity channel not running Check Status of Connections on the server Start the WinCC Connectivity Station service or reconnect the archive from script
Rows appear on server but not on client screens Client cache not invalidated; User Archive control not refreshing Toggle the picture window, or call uaCtrl.Refresh from VBScript Force a refresh on a timer in the picture, or restart the client runtime
BULK INSERT fails with lock timeout WinCC runtime still holds the user archive table open Check active connections in SQL Management Studio Pause the affected archive, then re-run the bulk insert
CSV file size grows unbounded on the staging share Import did not delete the file after load List share contents Add a cleanup script (for /f /q) to a scheduled task

Best Practices for Multi-Client Setups

  • Always use a UNC path for the export directory. Mapped drive letters are per-user and per-session and break when the client service starts before any interactive user logs on.
  • Name CSV files with the client computer name and a timestamp, e.g. UA_Batch_<computername>_<yyyyMMddhhmmss>.csv, to avoid collisions on a shared staging folder.
  • Place the staging share on a separate disk from the WinCC project and the SQL data files. Large CSVs can fill a small OS partition and stop the WinCC server.
  • Set a retention policy on the staging share—delete CSVs older than 7 days—to bound disk usage.
  • Prefer the User Archive import interface over BULK INSERT when the schema is stable; the interface honors the archive's primary key, field types, and trigger logic, which BULK INSERT bypasses.
  • Use Update mode for routine round-trips and Overwrite only for full re-loads. Append is the right choice for new batches.
  • Document the export/import sequence in the WinCC project documentation (the @PROJECT directory contains a template) so the maintenance team can re-run it after a server rebuild.

WinCC Version Compatibility

The mechanisms above apply to:

  • WinCC V6.2 SP2 / SP3 / SP4 — User Archive option is required and licensed on the server.
  • WinCC V7.0 / V7.0 SP1 — same architecture, additional column types (BLOB, DateTime with ms).
  • WinCC V7.2 / V7.3 — same automation interface; UserArchiveControl.Import signature unchanged.
  • WinCC V7.4 / V7.5 — Microsoft replaced the legacy connectivity with the WinCC Connectivity Pack; the UserArchiveControl still works but new deployments typically use the OPC UA / OLE DB connector for the same data.

For TIA Portal / WinCC Professional (the SCADA successor of the WinCC V6/V7 line), the user archive is replaced by User Archive (SQLite) in the WinCC RT Professional project, and the same round-trip is done through a WinCC RT Professional script that uses the HMIRuntime.Tags and HMIRuntime.DataSet interfaces, or through direct SQLite write on the server side.

FAQ

Where does the user archive CSV export land by default on a WinCC V6.2 client?

It lands in the directory configured under the user archive connection's Export folder field, defaulting to %TEMP% on the client if left blank. To have it land on the server, set the export folder to a UNC path such as \\<server>\<share>.

Can a WinCC client import directly into the user archive SQL database?

No. The user archive SQL database is opened exclusively by the WinCC Server service. Clients send rows over the WinCC connectivity channel through the UserArchiveControl automation interface, and the server commits them to SQL. Direct SQL writes from a client will fail with a lock or login error.

What is the difference between Append, Overwrite, and Update import modes?

Append (mode 0) adds new rows and rejects duplicates by primary key. Overwrite (mode 1) replaces any row whose primary key matches. Update (mode 2) updates only the fields present in the CSV and leaves other fields untouched. Use Append for new batches, Update for partial corrections, and Overwrite for full reloads.

Why does the CSV separator switch between comma and semicolon between computers?

WinCC uses the operating system's locale list separator, which is comma in English (en-US) and semicolon in German (de-DE). Set the separator explicitly in the user archive connection properties on both client and server, or use the import dialog's separator override, to avoid silent import failures.

Is the UserArchiveControl.Import method available in WinCC V7.4 and later?

Yes, the method is still available in WinCC V7.4 and V7.5 for compatibility. New projects typically use the WinCC Connectivity Pack or OPC UA for user archive access, but UserArchiveControl.Import continues to work for the same round-trip use case described here.

Back to blog