Exporting WinCC Alarm Logs to Excel: TIA Portal V21 Methods
WinCC stores runtime alarms in a SQL Server archive (file-based or full instance), typically referenced as <Projectname>ALG.mdf. Operators, quality engineers, and maintenance technicians routinely need these records in Microsoft Excel for root-cause analysis, customer-facing reports, and trend analysis. The challenge is that the alarm archive is a proprietary SQL Server database, and reading it directly bypasses Siemens licensing controls. This guide catalogs every supported pathway to move alarm data out of WinCC and into Excel, compares their cost, complexity, and runtime impact, and provides a verified step-by-step procedure for the officially supported method in TIA Portal V21 (WinCC Unified).
.mdf file outside an authorized runtime database connection may violate the WinCC EULA. Confirm the licensing terms for your installed WinCC version before selecting a method.
1. WinCC Alarm Database Architecture
Before selecting an export method, understand how the alarm subsystem persists data. WinCC Runtime (both Classic RT and Unified RT) writes to a SQL Server backend; the file name and default path differ by TIA Portal version.
| Edition | Database Engine | Alarm Log File | Default Archive Path |
|---|---|---|---|
| WinCC RT (TIA V13-V17) | SQL Server 2014/2016 Express (file-based) | <Project>ALG.mdf |
<Project>\Archive\<ComputerName>\AlarmLogging |
| WinCC Professional RT (V18-V20) | SQL Server 2019 Express |
<Project>ALG.mdf + ALG_log.ldf
|
<Project path>\Archive |
| WinCC Unified RT (V17-V20) | SQL Server 2019/2022 Express | Configured via "Logs" tab in alarm control | Runtime project storage directory |
| WinCC Unified RT (V21) | SQL Server 2022 Express | Per configured log + sub-log | Runtime storage path, user-defined |
Each alarm record persists fields such as MsgNumber, MsgText, MsgState, MsgTime, MsGCameTime, MsgGoneTime, MsgAckTime, MsgClass, MsgPriority, and configured user-defined fields. The exact column set is determined by the alarm class definition and the HMI tag logging configuration. Excel-bound exports should preserve the timestamp granularity down to milliseconds for forensic reporting.
2. Export Methods at a Glance
| Method | Required License | Output Format | Trigger | Engineer Effort |
|---|---|---|---|---|
| Native CSV export (WinCC Unified) | WinCC Unified ES + RT (base) | *.csv (UTF-8 or ANSI) | Operator button in alarm control | Low |
| Connectivity Pack (Classic / Professional) | WinCC Connectivity Pack | OLE DB, ODBC, OPC UA, WinCC OLE DB Provider | Script or external application | Medium |
| IndustrialDataBridge | WinCC IndustrialDataBridge | CSV, XLSX, XML, SQL | Schedule, trigger tag, or event | Medium-High |
| DataMonitor (Web) | WinCC DataMonitor | Excel add-in / web report | Web client user action | Medium |
| Direct MDF access (unsupported) | None (technical only) | SQL Server query result | Direct SQL tool | High + EULA risk |
3. Prerequisites for the Supported Method
The officially supported method for TIA Portal V21 is the integrated CSV export of the alarm control. Confirm the following before configuring:
- WinCC Unified V21 is installed (TIA Portal V21 Update 1 or later recommended).
- The HMI device is a Unified Comfort Panel (UCP) or Unified PC runtime with the alarm control placed in a screen.
- The HMI runtime license is active on the target device.
- The operator account has the "AlarmControl.Export" authorization (configured in the "User administration" of the HMI device).
- A writable storage path exists on the runtime device (local disk, network share, or USB).
- Microsoft Excel 2016 or later is installed on the target viewing machine (for
.csvimport via "Data > From Text/CSV").
4. Configuring the Native CSV Export (WinCC Unified V21)
Per the official TIA Portal V21 documentation (Configuring the export of alarms (RT Unified) - WinCC Unified), the alarm control includes a built-in "Export" button that writes the current alarm view to a *.csv file at runtime. The procedure below walks through every step.
4.1 Enable the Export Button in the Engineering System
- Open the TIA Portal V21 project and navigate to the Unified HMI device.
- In the project tree, double-click the screen that contains the alarm control.
- Select the alarm control. In the Inspector window, open the "Properties > Toolbar" tab.
- Locate the toolbar item "Export" (symbol icon: floppy disk with arrow). Set its visibility to "Visible" and configure its position in the toolbar order.
- Open "Properties > General > Export settings" and configure:
-
File name template - e.g.
Alarms_<Date>_<Time>.csv. Placeholders include<Date>,<Time>,<UserName>, and<DeviceName>. -
Storage path - UNC path, local path, or mapped drive, e.g.
\Fileserver\WinCCExports\orD:\Reports\Alarms\. -
Delimiter - select semicolon
;for Excel locales that use a comma as the decimal separator (most European locales) or comma,for US locale. - Character set - UTF-8 with BOM (recommended for multi-language alarms) or ANSI.
- Header row - enable to include column names in the first row.
-
File name template - e.g.
- Compile the project and download to the Unified device.
4.2 Configure User Authorization
- In the project tree, expand "Runtime settings > User administration".
- Add or edit the operator role that should be allowed to export.
- Assign the authorization "Alarm control: Export" (numeric value 7 in the default authorization set). The exact identifier may appear as
HMI_Export_Alarmsin the engineering view. - Confirm the role is assigned to the relevant users in the runtime user management.
4.3 Runtime Operator Procedure
- Log in to the Unified runtime as an authorized user.
- Open the screen containing the alarm control.
- Filter the alarm view to the desired time range using the filter bar (timestamp from/to, state, class, priority).
- Click the Export button in the alarm control toolbar.
- Choose the export scope: "Visible alarms" or "All alarms in filter".
- The runtime writes a
.csvfile to the configured path. A status popup confirms the file name and path. - Open Microsoft Excel > "Data > From Text/CSV", select the file, set the delimiter to match the configuration, and load.
4.4 Sample Output Structure
The exported .csv contains one row per alarm event (raise, clear, acknowledge) with the following representative columns (the exact set depends on the alarm class configuration):
Number;State;Date;Time;Text;Class;Priority;Acknowledged;User;Computer
1001;Came;2024-11-12;07:42:13.456;Motor M1 overload;Warning;5;No;;PLC_S7_1500
1001;Gone;2024-11-12;07:43:02.118;Motor M1 overload;Warning;5;No;;PLC_S7_1500
1001;Ack;2024-11-12;07:43:55.802;Motor M1 overload;Warning;5;Yes;OPERATOR_03;PLC_S7_1500
For Excel locales that require semicolon delimiters, change the system regional setting or import the file using "Data > From Text/CSV > Delimiter = Semicolon".
5. Alternative Supported Method: Connectivity Pack (Classic / Professional)
For TIA Portal versions V13-V20, the Connectivity Pack provides an OLE DB provider and OPC UA server for external data access. This is the standard path when integrating with custom reporting scripts or third-party SCADA dashboards.
5.1 Connection String
Provider=WinCCOLEDBProvider.1;Catalog=<Projectname>;Data Source=.\\WinCC
For the alarm log specifically, the standard query template is:
SELECT * FROM <Projectname>ALG WHERE DateTime >= '2024-11-12 00:00:00' AND DateTime <= '2024-11-12 23:59:59'
5.2 Excel VBA Script (Illustrative)
Sub ExportAlarms()
Dim conn As Object, rs As Object
Set conn = CreateObject("ADODB.Connection")
conn.ConnectionString = "Provider=WinCCOLEDBProvider.1;Catalog=MyProject;Data Source=.\\WinCC"
conn.Open
Set rs = CreateObject("ADODB.Recordset")
rs.Open "SELECT * FROM MyProjectALG WHERE DateTime >= '2024-11-12 00:00:00'", conn
Sheet1.Range("A1").CopyFromRecordset rs
rs.Close: conn.Close
End Sub
This approach requires the Connectivity Pack runtime license on the WinCC server and a valid OLE DB client license on the Excel host. The exported fields include all logging tags configured in the alarm class.
6. IndustrialDataBridge (Scheduled / Event-Driven Export)
IndustrialDataBridge is the right choice when the export must run unattended on a schedule or be triggered by a runtime event (e.g., a shift-end bit from the PLC). It supports direct XLSX output, which avoids the manual import step required for .csv.
6.1 Configuration Overview
- Add the IndustrialDataBridge option to the WinCC project (license key required).
- Create a new "Data Source" pointing at the WinCC alarm database via OLE DB.
- Create a "Data Target" of type "Excel File" with the destination path and template.
- Define the column mapping (alarm fields to Excel columns).
- Set the trigger to "Cyclic" (e.g., every 5 minutes), "Tag-triggered" (PLC bit), or "Event-triggered" (alarm class state change).
- Activate the bridge in the runtime start sequence.
IndustrialDataBridge also supports the "Append" mode, which appends new rows to an existing XLSX rather than overwriting, useful for monthly report accumulation. Ensure the file is not open in Excel during the write, or schedule the bridge for off-shift windows.
7. DataMonitor (Web-Based Excel Reports)
DataMonitor provides an Excel add-in and a web-based report designer. Operators can run a published report on demand from any browser session. The setup involves publishing the report template from the engineering system; the template embeds the OLE DB connection string and the SQL query. End users refresh the report from Excel and receive the latest alarm data without direct database access.
This is a good fit for customer-facing portals and multi-user environments where installing the Connectivity Pack OLE DB driver on every workstation is impractical.
8. Direct Access to the MDF File (Unsupported)
<Project>ALG.mdf file directly with SQL Server Management Studio while the WinCC runtime service holds the database exclusively can corrupt the archive. Even read-only access from a second instance requires the database to be in a state the WinCC service does not guarantee. This method is documented for diagnostic scenarios only and is not a supported export path.
For diagnostic purposes only, the database can be detached in single-user mode (WinCC runtime stopped) and inspected. The table ALLEVENTS or MSGVIEW contains the historical records; MSGLTPROC holds the long-term archive. Schema details vary by TIA Portal version; verify against the version-specific WinCC Information System.
9. Verification Checklist
After configuring the native export in WinCC Unified V21, validate end-to-end:
- Compile the project without warnings. The "Export" button should appear in the screen's alarm control during simulation.
- Start the WinCC Unified simulator or download to the HMI device.
- Generate a test alarm (use a force tag in PLCSIM or toggle a configured alarm tag).
- Log in with a user holding the export authorization, apply a filter, and click "Export".
- Confirm the
.csvfile appears at the configured path. Check file size and the "created" timestamp in Windows Explorer. - Open the
.csvin Notepad and verify the delimiter, header row, and BOM (if configured). - Import into Excel using "Data > From Text/CSV". Verify the column count, milliseconds in the time column, and that multi-byte text renders correctly.
- Repeat the export with an unauthorized user. The "Export" button should be disabled or hidden per the user administration settings.
10. Troubleshooting Matrix
| Symptom | Probable Cause | Resolution |
|---|---|---|
| "Export" button is not visible at runtime | Toolbar item disabled in engineering | Properties > Toolbar > Export = Visible, recompile, redownload |
| Button visible but no file is written | User lacks authorization | Assign "Alarm control: Export" to the user role |
| Export writes empty file (0 KB) | Storage path unreachable or no alarms in filter | Test the path with a manual file create; widen the filter |
| Excel imports all data into one column | Wrong delimiter chosen for locale | Match delimiter to regional settings or use the Excel import wizard with manual delimiter selection |
| Multi-byte characters appear as mojibake | Character set mismatch | Configure UTF-8 with BOM; import in Excel via "Data > From Text/CSV" and set File Origin to 65001 (UTF-8) |
| IndustrialDataBridge fails to open XLSX | File is locked by Excel | Close Excel or switch the bridge to write a new file per run |
| Connectivity Pack OLE DB error "Catalog not found" | Project name mismatch | Use the exact project name as configured in TIA Portal (case-insensitive) |
| Exported times are off by one hour | Daylight saving time not handled in archive | Use UTC in the export template, or stamp the export with a timezone tag in the alarm class |
11. Performance and Sizing Considerations
For high-volume alarm archives, the size of the exported .csv scales with the row count. Rough sizing guidance:
- Average row size with 12 columns: ~150 bytes.
- One million alarm events: ~150 MB raw CSV.
- Excel's hard row limit is 1,048,576 rows per sheet; very large exports should be split by date in the export template (e.g.
Alarms_<Date>.csv) and loaded into separate sheets or a Power Query model.
For long-term archive queries, point IndustrialDataBridge at the long-term archive (MSGLTPROC) rather than the active log to avoid runtime contention with the alarm subsystem.
12. Summary and Method Selection Guide
- Single operator, ad-hoc export, TIA V21: use the native CSV export in the alarm control. No additional license required.
- Scheduled, unattended, XLSX output: deploy IndustrialDataBridge with a cyclic or tag-triggered schedule.
- Custom reporting, BI integration, OPC UA: use the Connectivity Pack and an external consumer (Excel VBA, Power BI, Python).
- Multi-user web access, no client install: deploy DataMonitor with published Excel templates.
-
Engineering diagnostics only: stop the runtime, attach the
.mdfin read-only mode, and inspect with SSMS. This is not a production export path.
Each method is fully supported by Siemens and aligns with the licensed runtime options. Selecting the right one depends on report frequency, user count, file format requirements, and existing infrastructure. For TIA Portal V21, the built-in alarm control export is the lowest-effort, fully supported first choice; reserve IndustrialDataBridge and the Connectivity Pack for automated and multi-system scenarios.
FAQ
Can I export WinCC alarms to Excel without buying an optional package?
Yes, in TIA Portal V21 (WinCC Unified), the alarm control includes a native "Export" button that writes a .csv file at runtime. The base WinCC Unified runtime license covers this feature; no additional Connectivity Pack, IndustrialDataBridge, or DataMonitor license is required. See Configuring the export of alarms (RT Unified) - WinCC Unified.
Where is the WinCC alarm archive file located?
The default path is <Project path>\Archive\<ComputerName>\AlarmLogging\<Projectname>ALG.mdf for WinCC Professional (V13-V20). In WinCC Unified V21, the path is configured in the HMI device's "Logs" tab and points to the runtime project storage. The file is paired with ALG_log.ldf for the SQL transaction log.
Which Excel delimiter should I use for the exported CSV?
Use semicolon ; in locales where the comma is the decimal separator (Germany, France, Italy, most of Europe), and comma , in US/UK locales. The delimiter is configured in the alarm control's "Export settings" in TIA Portal and must match the Excel regional setting to avoid all data landing in a single column.
Why does the "Export" button not appear in the alarm control at runtime?
Two common causes: the toolbar item is disabled in the engineering view (Properties > Toolbar > Export = Visible), or the logged-in user lacks the "Alarm control: Export" authorization. Recompile the project after enabling the toolbar item, and verify the user role in the HMI's user administration.
How do I schedule an automatic alarm export every hour?
Use the IndustrialDataBridge option: configure the data source as the WinCC alarm database, the data target as an XLSX file, the trigger as "Cyclic" at 1-hour interval, and "Append" mode for monthly accumulation. The WinCC IndustrialDataBridge license is required on the runtime server.