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.
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
- In SIMATIC Manager, expand the
S7 Programcontainer and double-click the target DB. STEP 7 opens the DB editor in Declaration View by default. - From the View menu select Data View. The columns change to Address | Name | Type | Initial Value | Actual Value | Comment.
- 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.
- Press Ctrl+C. SIMATIC Manager places a tab-delimited block of text on the Windows clipboard.
- 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 |
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
- Open Settings > Printers & Scanners (Windows 10/11) or Control Panel > Devices and Printers (Windows 7).
- Click Add a printer. Choose The printer that I want isn't listed.
- Select Add a local printer or network printer with manual settings.
- On the Choose a printer port step, choose Create a new port and pick Local Port from the type dropdown.
- When prompted for a port name, enter
FILE:(uppercase, colon included). Windows will later prompt for a filename each time you print. - On the manufacturer list choose Generic, then select Generic / Text Only as the model. Click Next.
- Name the printer
STEP7_DB_Export(or similar). Do not share it. Click Next and Finish. - Right-click the new printer and choose Printer properties → Preferences → Advanced (or Paper / Quality tab on older drivers).
- Set paper size to User Defined. Enter values larger than the longest row you expect;
Width = 200characters,Height = 2000 cmprevents unwanted page breaks inside a long BOOL comment. - Set Paper source to Continuous form - No page break. Click OK.
Print the DB to file
- Open the target DB in STEP 7. Switch to Data View (View → Data View).
- From the File menu select Print Setup. Choose
STEP7_DB_Exportas the printer and the user-defined paper size. - 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. - Click OK. Windows prompts for an output filename. Use
C:\Temp\DB101.txt. - Open
DB101.txtin 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
- In Excel, click File → Open and select
DB101.txt. Choose Delimited in step 1 of the Text Import Wizard, then Next. - Switch the wizard to Fixed Width in step 2. Click Next.
- 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,CHARto a uniform 4-char column). - Break 4: immediately before the comment column.
- 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
- In SIMATIC Manager, right-click the target DB in the project tree and choose Generate Source.
- Choose a destination in the
Sourcesfolder. STEP 7 prompts for a block selection. Add the DB and click OK. - Double-click the new STL source. The text window shows each data element as an AWL line. Example:
Run_Enable : BOOL ; - 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)
- Open the TIA Portal project. Add a new Watch table under PLC_x → Watch and force tables.
- 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.
- Establish an online connection (Go online → Monitor all).
- 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)
- Open the PLC tags editor under the target device.
- If the tags are declared at the device level (not inside a DB), select all rows and choose Export → CSV from the toolbar.
- Re-import is symmetric: Import → CSV reconstructs the tag table.
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.
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:
-
Byte-count parity: Sum the byte widths of every exported row and compare to
DB length in bytesas reported by STEP 7 (right-click the DB → Object Properties → General). - Round-trip test: Modify one value in the Excel sheet, re-paste into STEP 7, compile, download, and verify the online value matches.
- 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.
- 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.
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.