XLSX Metadata: How to View, Edit and Remove It Safely
Understand which XLSX metadata is useful, sensitive or required for correct rendering.
The Two Structural Layers of XLSX Metadata
XLSX files store metadata in two distinct locations. Confusing them is the primary cause of data leaks and rendering failures in automated pipelines.
Package-level metadata resides in /docProps/core.xml and /docProps/app.xml. These conform to the Dublin Core and OPC (Open Packaging Convention) standards. core.xml holds dc:creator, dc:created, cp:lastModifiedBy, and dcterms:modified. app.xml holds application-specific counters: AppVersion, TotalTime, Application, and Company.
Document-level metadata lives inside xl/workbook.xml and individual sheet files under xl/worksheets/. This includes revision identifiers (<sheetPr codeName="...">), workbook-level <definedNames> that can leak internal paths or usernames, and <workbookPr> attributes such as date1904 and defaultThemeVersion.
MS-XLSX §3.3 specifies that [Content_Types].xml must declare application/vnd.openxmlformats-package.core-properties+xml for core properties and application/vnd.openxmlformats-officedocument.extended-properties+xml for extended properties. Removing either declaration while the corresponding part file remains on disk creates a schema mismatch. Removing the part file while the declaration persists causes strict OPC validators to reject the package.
Metadata That Survives "Save As" and Copy-Paste
Pasting cell contents into a new workbook does not strip metadata. Three categories persist across this operation.
Author and machine traces. cp:lastModifiedBy frequently contains the Active Directory login or local Windows username under which the editing session ran. dc:creator preserves the original author string even after the file is deleted from disk and recreated from a template.
Editing duration. TotalTime in app.xml accumulates editing minutes across all save sessions in integer-minute resolution. This value is independent of the Track Changes feature and cannot be reset from the Excel UI.
Revision identifiers. xl/workbook.xml contains <sheetPr codeName="..."> attributes on each sheet element. These are hex-encoded identifiers that correlate to the creation environment. They are invisible in Excel's interface and persist through "Inspect Document."
Validation check: Rename the .xlsx extension to .zip, extract the archive, and open docProps/app.xml in a text editor. Search for <TotalTime> and <LastPrinted>. LastPrinted records the last print action from any machine that opened the file, even if the current user never invoked print.
Viewing Metadata Without Extracting the Archive
Two methods read metadata while preserving the ZIP structure intact.
Method 1 — Python (in-memory XML parsing)
import zipfile
from xml.etree import ElementTree
with zipfile.ZipFile("report.xlsx", "r") as z:
core = ElementTree.parse(z.open("docProps/core.xml")).getroot()
app = ElementTree.parse(z.open("docProps/app.xml")).getroot()
ns = {
"dc": "http://purl.org/dc/elements/1.1/",
"cp": "http://schemas.openxmlformats.org/package/2006/metadata/core-properties",
}
creator = core.find("dc:creator", ns)
modified_by = core.find("cp:lastModifiedBy", ns)
total_time = app.find("TotalTime")
print(f"Creator: {creator.text if creator is not None else 'absent'}")
print(f"LastModifiedBy: {modified_by.text if modified_by is not None else 'absent'}")
print(f"TotalTime: {total_time.text if total_time is not None else 'absent'}")
This reads raw XML from the ZIP stream without writing to disk. It will not trigger antivirus heuristics that flag temporary extraction folders.
Method 2 — exiftool (single-command readout)
exiftool report.xlsx
ExifTool reads both OPC property layers and reports Creator, Last Modified By, Create Date, Modify Date, Application, and Total Edit Time. It does not parse xl/workbook.xml, so it misses revision identifiers and defined names. For 90% of metadata audit tasks, this is sufficient.
Editing Metadata Without Corrupting the OPC Package
Direct XML manipulation inside the ZIP archive is the most reliable method. Do not extract the archive to a folder, edit files, and recompress with a general-purpose ZIP tool. Excel requires that [Content_Types].xml, xl/workbook.xml, and xl/_rels/workbook.xml.rels use the store method (compression method 0, no deflate). The remaining parts may use deflate. A ZIP tool that applies deflate to these three files produces a package that opens in Excel but fails OPC validation.
Safe edit procedure
import zipfile
from xml.etree import ElementTree as ET
CRITICAL_STORED = {
"[Content_Types].xml",
"xl/workbook.xml",
"xl/_rels/workbook.xml.rels",
}
def sanitize_metadata(input_path, output_path, creator="user", last_modified_by="user"):
with zipfile.ZipFile(input_path, "r") as zin:
with zipfile.ZipFile(output_path, "w", zipfile.ZIP_DEFLATED) as zout:
for item in zin.infolist():
data = zin.read(item.filename)
if item.filename == "docProps/core.xml":
root = ET.fromstring(data)
ns = {
"dc": "http://purl.org/dc/elements/1.1/",
"cp": "http://schemas.openxmlformats.org/package/2006/metadata/core-properties",
}
for elem in root.findall(".//dc:creator", ns):
elem.text = creator
for elem in root.findall(".//cp:lastModifiedBy", ns):
elem.text = last_modified_by
data = ET.tostring(root, encoding="utf-8", xml_declaration=True)
compress = (
zipfile.ZIP_STORED
if item.filename in CRITICAL_STORED
else zipfile.ZIP_DEFLATED
)
zout.writestr(item, data, compress_type=compress)
This preserves the original compression method per part and only mutates the metadata XML. After running, open the file in Excel and check File > Info — the edited values appear immediately under Related People and Properties.
Complete Removal Versus Sanitization
Complete removal of docProps/core.xml and docProps/app.xml is permitted by the OPC specification — these parts are optional. However, Excel and Google Sheets regenerate them with default values on the next save. More critically, any pipeline that validates [Content_Types].xml against referenced parts will reject the file. SharePoint preview generators and ODF converters are common failure points.
Sanitization preserves the XML element structure while replacing all string values with static placeholders. This keeps the package conformant.
<!-- Before -->
<cp:lastModifiedBy>jsmith-windows-10-desktop</cp:lastModifiedBy>
<!-- After -->
<cp:lastModifiedBy>user</cp:lastModifiedBy>
Do not delete the <cp:lastModifiedBy> element entirely. Some parsers treat a missing mandatory child as a fatal schema error. Set it to a fixed string instead.
Non-Metadata Locations That Leak Information
Three locations are frequently misclassified as metadata but reside outside docProps/.
Custom file properties in docProps/custom.xml are created by macros, add-ins, or VBA routines. Delete this file entirely if you did not author custom properties. Its absence does not violate OPC conformance.
Sheet-level print settings in xl/worksheets/sheet1.xml contain <pageMargins>, <pageSetup paperSize="...">, and <printOptions>. These record printer names and paper dimensions that can reveal the physical location where the file was last configured for print.
Shared strings in xl/sharedStrings.xml are not metadata but retain deleted cell text. Excel's Document Inspector does not purge unreferenced shared string entries. The only reliable removal method is rebuilding the workbook or using a dedicated sanitizer that rewrites the shared string table with only referenced entries.
Post-Sanitization Validation
After editing metadata, run the following checks to confirm the operation succeeded.
- Re-run
exiftoolon the output file. If any field still shows a real name, date, or duration, the edit did not persist. - Open the file in Excel and navigate to
File > Info > Inspect Workbook > Check for Issues > Inspect Document. Run the Document Inspector and verify that "Document Properties and Personal Information" shows no remaining data. - Validate OPC conformance with a schema-aware tool. The Python
openpyxllibrary performs structural validation on load:
from openpyxl import load_workbook
wb = load_workbook("sanitized.xlsx")
If load_workbook raises no exceptions, the package structure is intact. If it fails, the ZIP compression method on a critical part was likely altered — revert to the original and repeat the edit using the compression-preserving procedure above.
Hard Limits and Edge Cases
TotalTimemaximum value: The OPC extended-properties schema definesTotalTimeasxsd:integerwith no upper bound in the schema, but Excel caps display at 2,147,483,647 minutes (32-bit signed integer maximum). Values exceeding this wrap silently in older Excel versions.dc:creatormultiplicity:core.xmlpermits multiple<dc:creator>elements. Sanitization must iterate all instances, not just the first.- Encrypted workbooks: Metadata in password-protected
.xlsxfiles is not encrypted. The OPC package encryption applies only toxl/workbook.xmland sheet parts.docProps/remains in plaintext inside the ZIP. Treat encrypted files as metadata-leaking by default.
Technical basis for XLSX Metadata
Format-level claims use the primary XLSX reference.