Configuring WinCC V7 DataMonitor for Automated CSV Email Reports

David Krause13 min read
SiemensTutorial / How-toWinCC
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

Configuring WinCC V7 DataMonitor for Automated CSV Email Reports

Many WinCC V7 sites accumulate process data in MS SQL Server archives (Tag Logging and Alarm Logging). Operators, quality teams, and remote engineers frequently need that historical data as CSV files delivered to inboxes on a fixed schedule, and ideally without manual export clicks. This reference shows how to do exactly that using the WinCC/Connectivity Pack and the WinCC DataMonitor option on a SIMATIC S7-400 station.

Scope: This document targets WinCC V7.0 / V7.2 running on Windows, with a CPU 414-3 controller, CP 443-1 Ethernet communications processor, and an IE CP 1612 A2 PC communications card. Where newer options exist (WinCC V8, WinCC Professional, WinCC Unified), they are called out separately so the procedure can be ported forward.

1. Problem Overview

The engineering requirement, as captured in the original field request, can be decomposed into four technical deliverables:

  1. Read data from the running WinCC SQL archive (Tag Logging segments and/or Alarm Logging segments).
  2. Convert that data to comma-separated values (CSV) automatically, with no operator interaction.
  3. Schedule the conversion on a fixed cadence (shift, daily, weekly) and/or on a process event (over-limit, batch end).
  4. Distribute the resulting file to recipients by SMTP e-mail and optionally publish it to the DataMonitor web portal for Intranet / Internet consumption.

All four deliverables are natively available inside the WinCC DataMonitor option suite, supplemented by the WinCC Connectivity Pack for the raw archive access. No VBScript or external SQL job is required for the standard path.

2. Prerequisites and Licensing

2.1 Hardware and Software Matrix

Component Model / Version Role
HMI software SIMATIC WinCC V7.0 SP3 (or V7.2 / V7.5) SCADA server with Tag/Alarm Logging
Option 1 WinCC/Connectivity Pack V7.0 OLE DB / OPC UA / WinCC OLE DB provider for archive access
Option 2 WinCC DataMonitor V7.0 Web publishing, Reports, Trends/Alarms via Intranet/Internet
PLC SIMATIC S7-400, CPU 414-3 (6ES7414-3XM05-0AB0 or later) Process controller, source of tags
Ethernet CP (PLC side) CP 443-1 (6GK7443-1EX20-0XE0) ISO-on-TCP / S7 communication to PC
Ethernet CP (PC side) IE CP 1612 A2 (6GK1161-2AA01) Hard real-time S7 channel on the WinCC station
Database Microsoft SQL Server 2005/2008 (bundled with WinCC V7) WinCC archive store
SMTP relay Internal mail server (Exchange, Postfix, hMailServer) Outbound e-mail transport
Client Any browser with ActiveX (IE 11) or modern browser for V7.4+ DataMonitor web client
Licensing note: DataMonitor and Connectivity Pack are licensed per WinCC server. Each option has its own license key and its own entry in the License Analysis tool of the WinCC Explorer. A single DataMonitor license covers an unlimited number of read-only web users, but write users require additional client licenses.

2.2 Network and Firewall Considerations

  • The DataMonitor server listens on TCP 80 (HTTP) and 443 (HTTPS) by default. If publishing to the Internet, terminate HTTPS on a reverse proxy or ISA/TMG and present a corporate certificate.
  • SMTP outbound from the WinCC server uses TCP 25 (or 587 with STARTTLS). Allow this in the corporate firewall.
  • The CP 1612 A2 must be set to Configuration mode = PC interface with SIMATIC protocol; do not run it in Softnet mode if the same PC uses standard S7 channel connections.

3. WinCC DataMonitor Architecture

The DataMonitor option sits on top of the WinCC Runtime database. Internally it uses the WinCC OLE DB Provider to query Tag Logging and Alarm Logging segments, and exposes that data through a web service. From the user’s perspective, four functions are available in the web portal:

Function What it does Used for CSV e-mail flow?
Trends & Tables Interactive trend and table views of online and historical data No (browse only)
Alarms Filtered view of Alarm Logging messages Sometimes (export)
Reports Predefined layouts, generated on demand or on schedule, saved to disk and e-mailed Yes - primary path
WebCenter / Web Navigator Process pictures, user administration Optional

The Reports function is the key piece. A WinCC report is essentially a WinCC project document (layout) populated with a selection of archive tags or messages and a trigger (time, event, manual).

4. Connectivity Pack vs Connectivity Station

Siemens sells two related but different options. Choosing the wrong one is the most common reason for a stalled deployment.

Aspect Connectivity Pack Connectivity Station
Installs on WinCC server or WinCC client Standalone PC with no local WinCC project
License Single license per installation Single license, used to consume WinCC data remotely
Access method WinCC OLE DB, OPC HDA / OPC UA server, WinCC IndustrialDataBridge OPC HDA / OPC UA client driver to a remote WinCC server
Typical use Local scripts, MS Office Excel add-in, custom .NET / VBA on the same machine Central historian that aggregates data from multiple WinCC servers
Required for DataMonitor Reports? Yes - DataMonitor uses the OLE DB provider installed by Connectivity Pack No - the server-side flow does not need it

Recommendation: For a single-server site that needs CSV e-mail reports, install Connectivity Pack on the WinCC server (the same machine that hosts DataMonitor). Connectivity Station is only required if you are pulling data into a third-party historian on a different PC.

5. Configuring the WinCC Report Designer

5.1 Launch the Designer

On the WinCC server, open WinCC Explorer > Tools > Report Designer. The Report Designer is a page-layout editor that contains a Report Object Selection palette. The two relevant objects for CSV generation are:

  • Tag Table (for Tag Logging values)
  • Message Report (for Alarm Logging messages)

5.2 Build a Tag-Logging Report

  1. Drag a Table object onto a new page layout (.rpl).
  2. Open the table’s Selection dialog and connect it to a Tag Logging archive. Use the CC_AlgRtHdl provider string, e.g.:

    Provider=WinCCOLEDBProvider.1; Catalog=CC_OpenArch_<ProjectName>_<Server>_<DateTime>; Data Source=<SQLServer>\WinCC

    See Siemens support entry 40347325 for the exact catalog naming convention when working with backup archive segments.
  3. Add the time range filter, for example Last 24 hours or a named shift pattern.
  4. Pick the columns: Timestamp, Tag name, Value, Quality code, %LSL/%USL flags if needed.
  5. Set the Output format on the page to CSV via the Properties > Output tab. WinCC Report Designer writes the file with the extension specified in the layout properties; for a true CSV choose .csv.

5.3 Build a Message Report (Optional)

Drag a Message Report object onto a second page layout. Configure:

  • Message class filter (e.g. Errors and Warnings only)
  • Time range identical to the tag report
  • Columns: Date, Time, Class, State, Number, Text
  • Output: CSV

5.4 Save the Layout

Store the .rpl files under <Project>\PRT\ in the project directory so the WinCC Runtime can resolve them.

Field tip: Avoid .xlsx as the report output. Excel files generated by Report Designer use a legacy structure that some e-mail gateways strip. CSV is plain text and survives every transport.

6. Converting SQL Archives to CSV

The WinCC OLE DB Provider is the bridge between SQL Server archive segments and the Report Designer. The OLE DB provider exposes both online archives (currently being written) and backup archives (closed segments on disk or network share).

6.1 Online Archive Query

Use the runtime view CC_AlgRtHdl for live data and CC_AlgRtOnline for tag values. Example SQL issued by the Report Designer for one tag, last 60 minutes:

SELECT TOP 10000 
    Timestamp, 
    RealValue, 
    Quality 
FROM 
    (SELECT * FROM TAGLLOG:R<Project>.<TagName>,'*') AS t 
WHERE 
    Timestamp >= DATEADD(minute, -60, GETDATE()) 
ORDER BY 
    Timestamp ASC

The TAGLLOG:R prefix selects Runtime tag values; TAGLLOG:A selects Archive values, which is what the report needs for CSV export.

6.2 Backup Archive Query

When the runtime has rolled a segment to backup (a .ldf and .mdf pair under <Project>\ArchiveManager\), the report can still reach it by switching the OLE DB catalog to the backup name. The catalog follows the pattern CC_OpenArch_<ProjectName>_<ServerName>_<YYYYMMDDhhmm>. Detailed catalog discovery is documented in SIOS 40347325 - Access to archive backups in WinCC Runtime (Alarm / Tag Logging).

7. Configuring Time and Event Triggers

Open WinCC Explorer > Computer > Properties > Reports (chapter 4.8.1 of the WinCC V7 documentation set) to assign triggers to each layout.

7.1 Time-Triggered Reports

For a daily shift report at 06:00:

  1. In the Report list, add the .rpl layout created in Section 5.
  2. Tick Time-controlled and set the time to 06:00:00.
  3. Choose a recurrence: Daily, Weekly with selectable weekdays, or Monthly.
  4. For a shift pattern where the report must cover the previous 8 hours, add a Relative time range of Now - 8 h to Now in the layout’s selection dialog.

7.2 Event-Triggered Reports

For batch-end reporting, bind the layout to a binary tag or a discrete alarm:

  1. Tick Event-controlled.
  2. Select a tag (e.g. BatchEnd) from the S7-400 tag list, or an alarm number from Alarm Logging.
  3. Set edge detection: rising edge, falling edge, or both.

7.3 Manual Trigger

Operators can still call the same report from the DataMonitor web portal (Reports > Run now) for ad-hoc requests. Manual invocation writes to the same output directory as scheduled runs.

8. Configuring Email Delivery

Email distribution has two complementary paths. Choose the one that matches your architecture.

8.1 DataMonitor E-mail Action (Preferred for WinCC V7)

For a V7 server with DataMonitor, the SMTP settings are made once at server level and reused for every report:

  1. Open WinCC Explorer > Computer > Properties > Web Navigator / DataMonitor > E-mail.
  2. Enter the SMTP server FQDN, port (default 25), and the From address (e.g. [email protected]).
  3. If the relay requires authentication, fill in the User and Password fields. Plain, LOGIN, and NTLM are supported.
  4. Test with the Send test e-mail button before wiring it into reports.
  5. On the report layout, switch the Distribution property to E-mail and add recipients either as static addresses or by mapping a WinCC user group (e.g. Operators_Shift_A) to a distribution list.

The CSV is attached to the e-mail and is also stored on the DataMonitor server under <InstallDir>\WinCC\WebNavigator\Server\Web\Reports\<User>\<ReportName>\<Timestamp>.csv.

8.2 TM_MAIL from the PLC (For S7-1200/1500 Companion Stations)

When a CSV is needed at a different cadence than what DataMonitor offers - for example, only when the PLC detects a specific production event - the TM_MAIL instruction can be used on an S7-1200 or S7-1500. The S7-400 itself does not include a built-in e-mail instruction; in that case pair the S7-400 with an S7-1500 (or use a CP 443-1 IT with the older SMTP client function), and have the S7-1500 issue the mail.

Minimal example (SCL, S7-1500, TIA Portal V17+):

// FB "SendReportMail"
#iMailSent := FALSE;

#sToAddress := '[email protected]';
#sCcAddress := '';
#sSubject   := 'Batch report - Reactor 2 - ' + INT_TO_STRING(#iBatchNo);
#sBody      := 'See attached CSV. Generated at ' + 
               FORMAT(INT_TO_DINT(#iYear), '0') + '-' + 
               FORMAT(INT_TO_DINT(#iMonth), '00') + '-' + 
               FORMAT(INT_TO_DINT(#iDay), '00');

// Read the CSV from a script-generated file on the SD card
// and attach it as a multipart body
#sMailUserData := 'attachment;' + 
                  'C:\\reports\\batch_' + 
                  INT_TO_STRING(#iBatchNo) + '.csv';

"TM_MAIL_DB"(REQ := #iTrigger,
             ID   := 1,
             TO_S := #sToAddress,
            CC_S := #sCcAddress,
          SUBJECT := #sSubject,
             BODY := #sBody,
      MAIL_USER := #sMailUserData,
       ATTACHMENT := #sAttachmentName,
         MAIL_ID := "dbMail".id,
           DONE => #iDone,
         ERROR  => #iError,
     STATUSCODE => #iStatus);

IF #iDone AND NOT #iError THEN
    #iMailSent := TRUE;
END_IF;

For the complete TM_MAIL parameter reference and the supported SMTP extensions, see the official S7-1500 Communication function manual on the Siemens Industry Online Support portal.

Cybersecurity reminder: If the WinCC server has the built-in Windows firewall enabled, add an inbound rule for the DataMonitor HTTP/HTTPS ports and an outbound rule for TCP 25 / 587. Hardening guides for WinCC are published on the Siemens Industrial Security portal.

9. Public / Private Storage and Web Distribution

Reports produced by DataMonitor are placed on the server under two logical areas:

Area Path on server Access Use case
Public ...\WebNavigator\Server\Web\Reports\public\ All authenticated DataMonitor users Cross-shift KPIs, plant dashboards
Private ...\WebNavigator\Server\Web\Reports\<User>\ Only the owner user Personal archives, sensitive departments

Each user can be granted a different read/write quota in the DataMonitor user administration. CSV files in either area can be downloaded through the browser, consumed by an Intranet link, or - in the case of the public area - exposed to the Internet through a reverse proxy.

10. Verification and Commissioning

  1. Generate a test report manually. In WinCC Explorer, right-click the report layout and choose Print / Preview to confirm the CSV content is correct.
  2. Trigger the time-controlled job. Change the time-controlled job to fire in two minutes and watch WinCC_Sys.log for the entry Report: <name> generated.
  3. Confirm the SMTP relay received the message. In the SMTP server’s log, look for MAIL FROM:<wincc-reports@...> followed by RCPT TO:<...> and a DATA block with the CSV attachment.
  4. Check the DataMonitor web view. Browse to http://<server>/reports, log in, and confirm the same report is listed in My Reports.
  5. Validate the CSV in a downstream tool. Open the attached file in Excel or import it into Power BI; the comma delimiter, RFC 4180 quoting, and ISO-8601 timestamp must be preserved.
  6. Audit the archive access path. If the report must cover segments that have already rolled to backup, repeat step 1 with the time range pushed past the last segment boundary and verify the data is still present (refer to SIOS 40347325 for the catalog discovery procedure).

11. Troubleshooting Matrix

Symptom Likely cause Where to look Fix
Report never runs at scheduled time WinCC Runtime not started, or Report Designer licence missing License Analysis tool, WinCC ServiceMode log Start WinCC Runtime, install licence
Report runs but CSV is empty Time range filter set to Now - 0 or no tags selected Report Designer > Selection dialog Define a non-zero relative time range and confirm the tag selection
Data missing for older dates Report only reads the online archive; backup segments not joined WinCC Archive Manager, CC_OpenArch_... catalog list Switch to the backup-aware catalog as described in SIOS 40347325
E-mail not delivered SMTP relay blocks unauthenticated senders or wrong port Exchange/Postfix queue, WinCC_Sys.log for SMTP errors Use port 587 with STARTTLS, or add the WinCC server IP to the relay allow-list
CSV attachment is missing or zero bytes Output format set to PDF or path is read-only Report Designer > Layout properties Set output to CSV and write to a path the WinCC Runtime user can modify
DataMonitor web page shows WebClient not licensed DataMonitor licence not detected License Analysis tool Re-install the licence, restart the WinCC service
IE shows a script error when opening DataMonitor ActiveX disabled or Internet Explorer not in compatibility view for the site IE Internet Options > Security > Trusted Sites Add the DataMonitor URL to Trusted Sites and enable ActiveX controls
Tag values appear with Bad Quality in the CSV CP 1612 A2 connection lost or S7-400 in STOP WinCC Channel Diagnostics, SIMATIC Manager diagnostic buffer Verify the S7 connection, restart the PLC if required

Which WinCC option do I need to send archived data automatically as a CSV e-mail?

Install WinCC DataMonitor on the WinCC server. DataMonitor includes the Reports function (chapter 4.8.1 of the WinCC V7 manual) that can generate CSV on a time or event trigger and e-mail it via the configured SMTP relay. The Connectivity Pack is also required because it installs the WinCC OLE DB provider the Reports engine uses to read SQL archive segments.

Do I need Connectivity Station in addition to Connectivity Pack?

No, not for a single-server site. Connectivity Station is for a separate PC that pulls data from one or more remote WinCC servers (typically a central historian). For a local CSV report flow the Connectivity Pack on the WinCC server is sufficient.

Can DataMonitor read archive data that has already rolled to backup?

Yes. Switch the OLE DB catalog from the default runtime catalog to the backup catalog named CC_OpenArch_<ProjectName>_<ServerName>_<YYYYMMDDhhmm>. The exact procedure and the catalog discovery steps are described in Siemens support entry 40347325.

Why are my CSV files delivered as Excel spreadsheets instead of CSV?

It usually means the report layout’s Output property is set to XLS or PDF. Open the layout in Report Designer, select the page, and set Properties > Output > File format to CSV. Also verify that the Distribution tab still has E-mail selected after the change.

Can the S7-400 CPU 414-3 send the e-mail itself instead of going through DataMonitor?

The S7-400 has no built-in e-mail instruction. Use the WinCC DataMonitor path on the PC, or add an S7-1500 / CP 443-1 IT that runs the TM_MAIL instruction against the same archive. For S7-1500 / S7-1200 stations, fill the MAIL_USER and ATTACHMENT parameters and provide an SMTP server reachable from the PLC.

Back to blog