XLS Metadata: How to View, Edit and Remove It Safely
Understand which XLS metadata is useful, sensitive or required for correct rendering.
Required vs. Optional Metadata in the Binary Format
Every valid XLS file is an OLE2 compound document containing a mandatory \x05SummaryInformation stream. This stream holds the Document Summary Information (DSI) structure, which Excel 97–2003 reads on open and rewrites on save. The DSI includes these fields:
| Field | Required by spec | Behavior when absent |
|---|---|---|
| Title | Yes | Parsers synthesize an empty string or fall back to the filename |
| Author | No | Excel populates it from the application's user name on save |
| Subject, Keywords, Comments | No | Absence causes no errors; Excel leaves them blank |
| Last Saved By | No | Written automatically; removing it causes Excel to repopulate it on next save |
| Revision Number | No | Incremented by Excel on each save; safe to zero |
| Create Date, Modify Date | No | Derived from filesystem timestamps if missing |
| Last Printed | No | Stored as a FILETIME structure; safe to clear |
The stream itself must remain present and structurally valid. Deleting the entire \x05SummaryInformation stream produces a file that Excel rejects as corrupted. You can zero individual string fields, but the DSI header and property set storage must stay intact.
The DocumentSecurity Stream
A separate stream named \x05DocumentSecurity stores workbook and sheet protection as a 4-byte little-endian integer:
0x00000000— No protection0x00000001— Workbook structure protected0x00000002— Workbook windows protected0x00000003— Both structure and windows protected
This stream is functional metadata, not documentary. Removing it entirely strips all protection, but Excel may treat the missing stream as a format error on strict validation. To remove protection safely, overwrite the 4 bytes with zeros rather than deleting the stream.
Hidden Data Beyond the SummaryInformation Stream
Cell Comments and Their Author Timestamps
Comments in XLS are stored as Note records inside the Workbook stream. Each Note record carries:
- An author string (defaults to the DSI Author field but can be overridden per comment)
- A creation timestamp (DATE structure, 8 bytes)
- A last-modified timestamp
- The comment text with optional rich-text formatting runs
Clearing visible comment text from the Excel UI does not delete the Note record. The author name and both timestamps persist. To remove a comment completely, you must delete the entire Note record from the Workbook stream. Partial removal leaves recoverable metadata.
Revision Tracking in the Revision Stream
When change tracking is enabled, Excel writes a hidden Revision stream containing every cell edit, the author of each change, and a timestamp. Disabling change tracking through the UI (Review → Track Changes → Accept/Reject) does not guarantee removal of this stream. The stream persists until explicitly cleared.
To confirm the presence of revision data, inspect the Book record inside the Workbook stream. The Book record contains a 2-byte grbitBook flags field at a variable offset. Bit 1 (0x0001) is the fChangeTracking flag. If set, the Revision stream may exist and should be checked.
Viewing Metadata Without Excel
Extracting DSI Fields with exiftool
exiftool -G -a -s spreadsheet.xls
The -G flag groups output by category. For XLS files, relevant groups are OLE (the SummaryInformation stream), XMP (if an embedded XMP packet exists), and File (filesystem-level attributes). Typical output includes OLE:Title, OLE:Author, OLE:LastSavedBy, OLE:CreateDate, OLE:ModifyDate, OLE:RevisionNumber, and OLE:TotalEditTime.
exiftool reads only the standard DSI property set. It cannot enumerate the DocumentSecurity stream or detect a hidden Revision stream.
Enumerating All OLE Streams with oletools
from oletools.olevba import OleVba
parser = OleVba("spreadsheet.xls")
for name, data in parser.ole_file.list_streams():
print(f"Stream: {name}, Size: {len(data)} bytes")
This lists every stream in the OLE2 container, including \x05SummaryInformation, \x05DocumentSecurity, and any Revision stream. The output does not decode binary content but reveals whether hidden streams exist. A Revision stream larger than a few hundred bytes indicates retained change-tracking data.
Editing Metadata While Preserving Structural Integrity
Modifying the SummaryInformation Stream
The DSI structure uses variable-length fields with offsets stored in a header. Changing a string length without recalculating offsets corrupts the stream. Direct byte editing is error-prone. Use a library that parses and rebuilds the OLE property set:
import olefile
ole = olefile.OleFileIO("spreadsheet.xls", write_mode=True)
# Read the existing stream
stream = ole.openstream('\x05SummaryInformation').read()
# Modify fields using a DSI-aware parser, then write back
# ole.write_stream('\x05SummaryInformation', modified_bytes)
ole.close()
The olefile library provides read/write access to OLE2 containers but does not parse DSI structures. For field-level editing, combine it with a property-set library that handles the PropertySetStream format defined in [MS-OLEPS].
Removing the Revision Stream
If a Revision stream is present and you have confirmed it contains stale change-tracking data, delete it directly:
import olefile
ole = olefile.OleFileIO("spreadsheet.xls", write_mode=True)
if ole.exists('Revision'):
ole.delete_stream('Revision')
ole.close()
After deletion, the file opens without warnings. The Revision stream is optional. However, if the fChangeTracking flag remains set in the Book record, Excel may recreate an empty Revision stream on the next save.
Clearing Protection Without Deleting the Stream
import olefile
ole = olefile.OleFileIO("spreadsheet.xls", write_mode=True)
if ole.exists('\x05DocumentSecurity'):
ole.write_stream('\x05DocumentSecurity', b'\x00\x00\x00\x00')
ole.close()
This preserves the stream's presence while setting protection to none. Verify by opening the file and confirming that previously locked cells are now editable.
Hard Limits and Observable Validation Checks
Structural Requirements
The XLS format specification MS-XLS Section 2.1.2 mandates the \x05SummaryInformation stream. Files missing this stream fail validation in Excel and LibreOffice Calc. The Workbook stream is non-negotiable; it contains all cell data, formulas, formatting, and named ranges.
Validation After Editing
- Open in LibreOffice Calc. LibreOffice applies stricter OLE2 structure checks than Excel. A file that opens without warnings in Calc is structurally sound.
- Check file size. After removing a
Revisionstream, the file size should decrease by the exact byte count of the deleted stream. No other streams should change size. - Verify residual metadata with exiftool:
exiftool -OLE:Author -OLE:Title -OLE:LastSavedBy cleaned.xls
All three fields should return empty values or the field name with no associated data.
- Inspect the DocumentSecurity value. If you zeroed it, confirm that
exiftoolshows no protection flags (thoughexiftoolmay not expose this stream directly; use a hex dump of the stream to verify the 4-byte value is0x00000000).
What Cannot Be Removed
Three streams are structurally required for a valid XLS file:
Workbook— Contains all cell data, formulas, styles, and sheet definitions. Removal destroys the spreadsheet.\x05SummaryInformation— Must exist as a valid OLE property set stream. Individual string fields can be zeroed, but the stream structure must remain.\x05DocumentSecurity— Must exist. Its value can be set to0x00000000, but deleting the stream may cause strict parsers to reject the file.
Removing any of these three streams produces a file that Excel cannot open. The format specification treats them as mandatory OLE2 directory entries.
Technical basis for XLS Metadata
Format-level claims use the primary XLS reference.