Exporting STEP 7 Data Blocks to Excel: Four Proven Methods

David Krause14 min read
HMI ProgrammingSiemensTutorial / 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

Engineers commissioning SIMATIC S7-300, S7-400, S7-1200, and S7-1500 controllers routinely need to lift Data Block (DB) content out of STEP 7 and into Microsoft Excel for one of three reasons: documentation against a Functional Design Specification, off-line batch parameter editing of recipe values, or comparison of a project revision against a baseline. STEP 7 V5.x (the SIMATIC Manager environment) ships without a native "Export to XLSX" command, and TIA Portal V13 through V18 only exposes a CSV export from the watch table and the PLC tag table. The good news is that four field-proven techniques cover every practical export scenario, and each preserves the variable name, the absolute address (DBW0, DBX2.0, DBD4), the data type, the initial value, and the comment to a different fidelity level.

This reference walks through the four techniques in order of complexity, beginning with a one-keystroke copy/paste from the Data View of a DB, continuing through the Generic / Text Only Windows printer driver, the AWL/STL source-file export, and finally the TIA Portal watch-table path used on S7-1200/1500 projects. Each section ends with a verification checklist. A troubleshooting matrix at the end maps the most common failure modes to root cause and fix.

Scope: This article targets STEP 7 V5.5 / V5.6 / V5.7 (SIMATIC Manager) for S7-300 / S7-400 / WinAC and TIA Portal V15.1 / V16 / V17 / V18 for S7-1200 / S7-1500 / ET 200SP. S7-200 (Micro/Win) is not covered because it stores V-memory in a single data area and uses a different export workflow.

Prerequisites and Compatibility Matrix

Confirm the following before selecting an export method. Mixing an incompatible combination is the single most common reason for failed exports.

Requirement Method 1 (Copy/Paste) Method 2 (Print to File) Method 3 (AWL Source) Method 4 (TIA Watch Table)
STEP 7 V5.3 or later Required Required Required Not applicable
TIA Portal V15.1 or later Not applicable Not applicable Not applicable Required
Microsoft Excel 2010 or later Required Required Helpful (text editor OK) Required (CSV import)
Windows administrator rights No Yes (printer install) No No
Compiled DB (no source errors) Yes Yes Optional Yes (online or offline)
Preserves absolute DB address No Yes Yes Yes (in symbol form)
Handles mixed STRUCT / ARRAY Partial Yes Yes Yes

The compatibility matrix is deliberately conservative. Older STEP 7 service packs (V5.1, V5.2) lack the Data View context-menu copy behaviour described in Method 1 and were retired by Siemens years ago; always run the latest service pack referenced in the Siemens Industry Online Support (SIOS) download centre.

Method 1 — Native Copy/Paste from the Data View

The fastest path. Works on any DB whose body contains a single repeated data type (e.g. an ARRAY[0..499] OF INT, or a flat BOOL map). It does not preserve the absolute byte/bit address because the Data View shows one row per symbol, not per byte.

Procedure

  1. In SIMATIC Manager, expand the S7 Program container and double-click the target DB. STEP 7 opens the DB editor in Declaration View by default.
  2. From the View menu select Data View. The columns change to Address | Name | Type | Initial Value | Actual Value | Comment.
  3. Click the top-left cell of the table grid (row 0, column "Address"). Press Ctrl+Shift+End to extend the selection to the last row of the DB.
  4. Press Ctrl+C. SIMATIC Manager places a tab-delimited block of text on the Windows clipboard.
  5. Open Excel. Click cell A1. Press Ctrl+V. Excel splits the block into columns using the embedded tab character.

What you get

Column Source Notes
A Address (e.g. +0.0, +2.0) Relative to start of DB; prefix DB number is missing
B Symbolic name Empty if DB was declared without symbols
C Data type (full mnemonic, e.g. REAL, BOOL) May be longer than 4 characters
D Initial value Numeric or quoted string
E Comment May be truncated at 80 chars on paste
Limitation: When the DB contains a nested STRUCT, the Data View expands the struct into individual rows. Mixed data types in the same block (BOOL + INT + REAL) paste correctly because every column is preserved, but the absolute offset (DBX0.0, DBW2, DBD4) is not reproduced in a way that re-imports cleanly without a manual address column fix-up.

Verification

After paste, count the number of rows in Excel and compare to (DB length in bytes) / (row width in bytes). For an ARRAY[0..99] OF REAL this should be exactly 100 rows. Mismatched counts indicate a partial selection (Ctrl+Shift+End failed).

Method 2 — Generic / Text-Only Printer Driver

This is the original field-recommended procedure for engineers who need an exact byte/bit address and who work with heterogeneous DBs. It uses a Windows Generic / Text Only printer configured to print to a file instead of a physical device. STEP 7 formats the DB into the printer stream exactly the way it appears in the Data View, so every column lands in a predictable column position.

Install the printer driver

  1. Open Settings > Printers & Scanners (Windows 10/11) or Control Panel > Devices and Printers (Windows 7).
  2. Click Add a printer. Choose The printer that I want isn't listed.
  3. Select Add a local printer or network printer with manual settings.
  4. On the Choose a printer port step, choose Create a new port and pick Local Port from the type dropdown.
  5. When prompted for a port name, enter FILE: (uppercase, colon included). Windows will later prompt for a filename each time you print.
  6. On the manufacturer list choose Generic, then select Generic / Text Only as the model. Click Next.
  7. Name the printer STEP7_DB_Export (or similar). Do not share it. Click Next and Finish.
  8. Right-click the new printer and choose Printer properties → Preferences → Advanced (or Paper / Quality tab on older drivers).
  9. Set paper size to User Defined. Enter values larger than the longest row you expect; Width = 200 characters, Height = 2000 cm prevents unwanted page breaks inside a long BOOL comment.
  10. Set Paper source to Continuous form - No page break. Click OK.

Print the DB to file

  1. Open the target DB in STEP 7. Switch to Data View (View → Data View).
  2. From the File menu select Print Setup. Choose STEP7_DB_Export as the printer and the user-defined paper size.
  3. From the File menu select Print. In the dialog, do not tick Print to file — the redirect to FILE: is automatic because of the port choice.
  4. Click OK. Windows prompts for an output filename. Use C:\Temp\DB101.txt.
  5. Open DB101.txt in Notepad. Delete the page-header and page-footer blocks that STEP 7 inserts (they contain the project name, page number, date/time). Save the file as plain ANSI or UTF-8.

Import into Excel with fixed-width columns

  1. In Excel, click File → Open and select DB101.txt. Choose Delimited in step 1 of the Text Import Wizard, then Next.
  2. Switch the wizard to Fixed Width in step 2. Click Next.
  3. Set the column breaks as follows:
    • Break 1: immediately before the variable name (typically column 10–14).
    • Break 2: at the start of the data-type column.
    • Break 3: four characters after the start of the data-type column (truncates REAL, BOOL, INT, DINT, WORD, DWORD, STRING, CHAR to a uniform 4-char column).
    • Break 4: immediately before the comment column.
  4. Click Finish. Save the workbook as .xlsx.

Sample row layout

  0.0  Run_Enable       BOOL  FALSE   "1 = Motor may start"

After the wizard the columns land at A=Address, B=Name, C=Type, D=Initial, E=Comment. The fourth line of the row example shows how the comment, which can be up to 80 characters wide, falls into a dedicated column without further parsing.

Verification

Sort column A and confirm byte offsets are sequential and non-overlapping. A gap larger than expected indicates a STRUCT whose members did not expand in the print stream — in that case repeat the procedure with the DB still in Declaration View first, print a copy, and merge the two sheets.

Method 3 — AWL/STL Source File Export

This method is preferred by software engineers who treat the DB like version-controlled code. STEP 7 can re-generate the textual AWL (Anweisungsliste, German for STL/Statement List) source from a compiled DB, and that source is plain ASCII — trivially diff-able in Git and trivially convertible to CSV with a single awk or PowerShell pass.

Generate the AWL source

  1. In SIMATIC Manager, right-click the target DB in the project tree and choose Generate Source.
  2. Choose a destination in the Sources folder. STEP 7 prompts for a block selection. Add the DB and click OK.
  3. Double-click the new STL source. The text window shows each data element as an AWL line. Example:
    Run_Enable : BOOL ;
  4. Save and close the source.

Convert AWL to CSV

The canonical AWL declaration line follows the pattern:

SYMBOL  :  DATATYPE  [:= INITIAL_VALUE]  ;  COMMENT

A PowerShell one-liner that handles STRUCT and ARRAY indentation:

Get-Content "DB101.awl" |
  Where-Object { $_ -match '^\s*\w+\s*:' } |
  ForEach-Object {
    ($_ -split ':')[0].Trim(),
    (($_ -split ':')[1] -split ';')[0].Trim(),
    (($_ -split ';')[1]).Trim() -join "\t"
  } | Out-File "DB101.tsv" -Encoding utf8

Open DB101.tsv in Excel with Tab as the delimiter. The result is a three-column sheet (Symbol, Type + Initial, Comment) with no absolute byte address — which is acceptable for documentation but requires a re-import script if you intend to round-trip values back into the PLC.

Verification

Compare the number of non-comment AWL lines to the byte count of the DB divided by the smallest element width. Discrepancies indicate multi-line ARRAY blocks that the script collapsed; handle those by extending the regex to capture trailing bracket lines.

Method 4 — TIA Portal Watch Table / PLC Tag Table (S7-1200 / S7-1500)

S7-1200 and S7-1500 projects are configured in TIA Portal rather than SIMATIC Manager. The DB export workflow lives behind the Watch table or the PLC tag table; TIA Portal exposes both as CSV exports. Reference the official Siemens Industry Online Support portal for the latest TIA Portal help set, in particular the Programming and Operating Manual for the S7-1500 CPU family.

Watch table path (online values)

  1. Open the TIA Portal project. Add a new Watch table under PLC_x → Watch and force tables.
  2. Drag every variable from the target DB into the watch table. For multi-instance DBs use Details view and the Add all tags of a DB toolbar button.
  3. Establish an online connection (Go online → Monitor all).
  4. Right-click anywhere in the table and choose Export → Export to CSV. Save the file.

The CSV carries columns Name | Address | Display format | Monitor value | Comment. Absolute addresses are preserved in the dot-decimal form used by TIA Portal (for example %DB101.DBX0.0, %DB101.DBW2, %DB101.DBD4).

PLC tag table path (declarations only, offline)

  1. Open the PLC tags editor under the target device.
  2. If the tags are declared at the device level (not inside a DB), select all rows and choose Export → CSV from the toolbar.
  3. Re-import is symmetric: Import → CSV reconstructs the tag table.
Caveat: Tags declared inside a DB are not surfaced in the device-level PLC tag table. For full DB coverage on S7-1200/1500 you must use either the watch-table path above or a third-party utility that walks the TIA Portal project XML (see Third-Party Utilities below).

Verification

After CSV import to Excel, pivot on the Address column. Gaps in the byte sequence indicate reserved padding bytes that TIA does not surface in the watch table — those are absorbed silently and can be ignored unless you need bit-exact documentation.

Data Type Coverage and Edge Cases

Data type Bytes Method 1 Method 2 Method 3 Method 4
BOOL 1 Yes Yes Yes Yes
BYTE / CHAR 1 Yes Yes Yes Yes
WORD / INT 2 Yes Yes Yes Yes
DWORD / DINT / REAL 4 Yes Yes Yes Yes
LREAL / LWORD 8 Yes Yes Yes Yes
STRING[n] n + 2 Yes (quotes) Yes (truncated) Yes Yes (escaped)
WSTRING[n] 2·n + 4 Partial Encoding sensitive Yes Yes
ARRAY of UDT n·sizeof(UDT) Yes Yes Yes Yes
Nested STRUCT > 3 levels Variable Partial Yes Yes Yes
DATE_AND_TIME (DT) 8 BCD-decoded BCD-decoded Raw hex Hex/decimal

Special cases:

  • STRING without explicit length defaults to 254 characters in S7-300/400 and 256 in S7-1500. The print-to-file output may wrap if the column break is set too tight.
  • WSTRING (Unicode) uses UCS-2 / UTF-16 encoding. STEP 7 V5.5 SP3 and earlier print WSTRING as hex pairs; TIA Portal renders them as readable Unicode. Force UTF-8 output when piping the file to Excel.
  • DATE_AND_TIME (DT) is stored in BCD; treat it as eight bytes of hex during export, then decode in Excel with =BCD2DEC(MID(HEX,A,B)) if a human-readable timestamp is required.

Third-Party Utilities

Several Windows utilities automate the bulk export of every DB inside a STEP 7 project. They typically scan the .s7p project file, launch STEP 7 in the background to print each DB to file, then concatenate the results into a single workbook. One open-source example is the Step7 Db To Excel tool hosted on SourceForge, which also generates an AWL file and can read actual online values from a connected SIMATIC CPU via MPI/Profibus/TCP. Treat such utilities as accelerators, not as primary documentation: always re-verify the export against one of the four methods above for at least one DB per project before committing the workbook to a controlled document.

Security: Third-party utilities that parse STEP 7 project files execute outside the SIMATIC Manager security model. Validate them on a non-production engineering workstation and never run them on a PC that holds the STEP 7 license dongle for a production cell.

Troubleshooting Matrix

Symptom Likely cause Fix
Excel pastes everything into column A Clipboard still contains rich text, not tab-delimited Paste with Home → Paste → Use Text Import Wizard instead of plain Ctrl+V
Print-to-file output wraps mid-comment Paper width smaller than longest row Reconfigure the Generic/Text driver with user-defined width > 200
Print-to-file file is empty Wrong port chosen — you configured FILE: in the printer but Windows printed to the default LPT1 Re-check Printer properties → Ports; ensure FILE: is checked, not LPT1
AWL source missing a DB DB has compilation errors or was generated as an instance DB without symbol Compile the DB first (Program → Compile All) and regenerate the source
TIA Portal CSV export truncates STRING at 254 chars Microsoft Excel column-width truncation in the wizard Re-import with Column data format = Text for the relevant column
Address column shows "+0.0" but project expects "DBX0.0" Method 1 used; copy/paste drops the DB number and adds a relative offset Use Method 2 (print-to-file) or post-process with ="DB"&101&"."&A1
Structured UDT expands to a single row DB was printed in Declaration View Switch to Data View and re-print (Method 2)
Re-import to STEP 7 fails with syntax error Excel auto-converted TRUE / FALSE initial values to uppercase or changed number formats Format the column as Text before re-pasting into STEP 7

Verification and Best Practices

Always close the export loop with one of the following checks:

  1. Byte-count parity: Sum the byte widths of every exported row and compare to DB length in bytes as reported by STEP 7 (right-click the DB → Object Properties → General).
  2. Round-trip test: Modify one value in the Excel sheet, re-paste into STEP 7, compile, download, and verify the online value matches.
  3. Hash check: For controlled documents, store the SHA-256 hash of the exported workbook alongside the STEP 7 project archive. Re-generate on every revision and compare.
  4. Symbol preservation: If the workbook feeds WinCC or another HMI/SCADA, confirm that every symbolic name still resolves — exporting from a renamed DB without re-running the symbol table update is a common field bug.
Best practice: Treat the Excel workbook as derived documentation, never as the master. The STEP 7 project remains the source of truth. Restrict write access to the project folder and treat edits to the workbook as change requests that drive an update of the STEP 7 source.

FAQ

Which method preserves the absolute DB address (DBX, DBW, DBD)?

Only Method 2 (Generic/Text-Only printer) and Method 4 (TIA Portal watch table CSV) reliably reproduce absolute addresses. Method 1 pastes relative offsets (e.g. +0.0) and Method 3 (AWL source) carries only the symbolic name and the data type.

Can I re-import the Excel sheet into STEP 7?

Yes for parameter values, with caveats. Format the relevant columns as Text to prevent Excel from coercing TRUE/FALSE or stripping leading zeros, then paste back into the DB editor in Data View. The address column must match the original STEP 7 row order exactly or the symbols will misalign.

Does the print-to-file method work on Windows 11 with the new print stack?

Yes, but install the legacy Generic/Text-Only driver manually through Add printer → The printer that I want isn't listed → Add a local printer → Generic → Generic / Text Only. The driver is still shipped in modern Windows installations.

Why does the TIA Portal watch table export skip my ARRAY tags?

TIA Portal flattens ARRAY tags only when the entire DB is dragged into the watch table. Add the DB root symbol (e.g. "DB_Flags") and use Monitor all; the export then includes every element with its computed address.

How do I export WSTRING (Unicode) values without corruption?

Save the printed or exported file as UTF-8 with no BOM, then open it in Excel via Data → From Text/CSV rather than Open; the import wizard exposes the file origin dropdown so you can force UTF-8 decoding.

Back to blog