The basics
What is an XLSX file?
XLSX is the standard file format for Excel workbooks. A workbook holds one or more sheets of cells, and the file keeps everything about them: values, formulas, number formats, colours, column widths, frozen panes, tables, filters, charts, comments and pivot tables.
Microsoft introduced it with Excel 2007, replacing the older binary .xls, and published it as part of the Office Open XML standard (ECMA-376, later ISO/IEC 29500). Because the format is documented, Google Sheets, LibreOffice Calc, Apple Numbers and libraries in most programming languages can read and write it.
Three things an XLSX file is not:
- Not a CSV. A CSV is plain text with one table and no types. An XLSX is a ZIP package that a text editor can't read.
- Not macro-enabled. An
.xlsxcan't contain VBA macros. Excel saves a workbook with macros as.xlsm. - Not the old XLS.
.xlsis the binary format from Excel 97 to 2003. Renaming one to.xlsxdoesn't convert it; Excel will usually refuse to open it until you change the name back.
Anatomy
What's inside an XLSX file
Rename an .xlsx file to .zip and you can open it like any ZIP archive. Inside are XML files called parts, tied together by relationship files. This is the structure of sample-workbook.xlsx from the samples below, with one row of its first sheet.
sample-workbook.xlsx (a ZIP archive, 10,384 bytes)
offset 0: 50 4B 03 04 … "PK", a ZIP local file header
[Content_Types].xml the type of every part
_rels/.rels where the workbook starts
docProps/core.xml title, author, dates
docProps/app.xml application properties
xl/workbook.xml sheet names and order
xl/_rels/workbook.xml.rels links to sheets, styles, strings
xl/worksheets/sheet1.xml sheet "Orders"
xl/worksheets/sheet2.xml sheet "Summary"
xl/worksheets/sheet3.xml sheet "About"
xl/worksheets/_rels/… links to the table and chart
xl/sharedStrings.xml each distinct text, stored once
xl/styles.xml number formats, fonts, fills
xl/theme/theme1.xml theme colours and fonts
xl/tables/table1.xml the OrdersTable definition
xl/drawings/drawing1.xml where the chart sits
xl/charts/chart1.xml the bar chart itself
Row 2 of xl/worksheets/sheet1.xml, indented for reading:
<row r="2">
<c r="A2" t="s"><v>7</v></c>
<c r="B2" s="2" t="n"><v>46296</v></c>
<c r="C2" t="s"><v>8</v></c>
<c r="D2" t="s"><v>9</v></c>
<c r="E2" t="n"><v>2</v></c>
<c r="F2" s="3" t="n"><v>12.5</v></c>
<c r="G2" s="3"><f>E2*F2</f><v>25</v></c>
</row>- 1
50 4B 03 04The ZIP signature
The first four bytes of every XLSX file, the same as any ZIP file. That's why tools that go by content, not extension, often report an XLSX as a ZIP archive.
- 2
[Content_Types].xmlContent types
Required in every package. It gives the media type of each part, so a reader knows which file is the workbook, which are sheets and which is the style sheet.
- 3
_rels/.relsRelationships
The entry point: it points to
xl/workbook.xml. Each part that refers to others has its own.relsfile in a_relsfolder next to it, and readers follow these links rather than relying on file names. - 4
docProps/core.xmlDocument properties
Title, author, last modified by, and created and modified dates. Easy to forget, and often contains a name the sender didn't mean to share.
- 5
xl/workbook.xmlThe workbook
Lists the sheets in order with their names and visibility, plus workbook-wide settings such as defined names and the date system.
- 6
xl/worksheets/sheet1.xmlA worksheet
The cells of one sheet, row by row. Only cells that have content or formatting are stored, so an empty sheet is tiny whatever its size limit.
- 7
xl/sharedStrings.xmlShared strings
Each distinct piece of text, stored once. Cells refer to an entry by its position, so a word repeated in 10,000 rows is stored once.
- 8
xl/styles.xmlStyles
Number formats, fonts, fills and borders. A cell's
sattribute is a position in this file's list of cell formats. - 9
<c r="A2" t="s"><v>7</v></c>A text cell
t="s"means "shared string", so7is not the value but a pointer: entry 7 insharedStrings.xml, which is the text000184. Stored as text, its leading zeros are safe. - 10
<c r="B2" s="2" t="n"><v>46296</v></c>A date
There is no date type. The cell holds the number 46296, the count of days in Excel's 1900 date system, and style 2 applies the format
yyyy-mm-dd, which displays it as 2026-10-01. - 11
<f>E2*F2</f><v>25</v>A formula and its result
The formula is stored without its
=, together with the result from the last calculation. Programs that don't calculate, such as previewers and many code libraries, show that stored result.
Under the hood
How an XLSX file is put together
XLSX uses the Open Packaging Conventions, the same packaging as DOCX and PPTX: a ZIP archive whose parts are mostly XML, connected by relationship files. The spreadsheet vocabulary inside is called SpreadsheetML.
- Text and numbers are stored differently. Numbers sit in the cell. Text usually goes into
xl/sharedStrings.xml, and the cell holds its index. Some programs write text directly into the cell as an inline string instead; both are valid. - Formats are separate from values. The cell stores
0.21; a style turns it into21%. The cell stores46296; a style turns it into a date. Code that reads values without styles sees the plain numbers. - Formulas carry their last result. Excel saves the result next to each formula, so a viewer can show values without calculating. Libraries that write formulas without results leave those cells blank in such viewers until Excel or another spreadsheet app recalculates.
- Compression keeps it small. XML is verbose, but it compresses well, so an XLSX is usually far smaller than the XML inside it.
sample-workbook.xlsxholds about 31 KB of XML in 10 KB.
Look inside one yourself
Copy an XLSX file, rename the copy to .zip and open it, or run unzip -l file.xlsx in a terminal. Opening xl/worksheets/sheet1.xml in a browser or code editor shows the cells as XML.
Related formats
XLSX vs XLS, XLSM, XLSB, ODS and CSV
| Extension | What it is |
|---|---|
.xlsx | The standard workbook: ZIP of XML, no macros. |
.xlsm | The same format with VBA macros allowed. Excel uses a separate extension so that macro content is visible from the file name. |
.xlsb | Excel's binary workbook: the same ZIP packaging, but sheets stored in a binary form that loads and saves faster. Not part of the ISO standard, and little supported outside Microsoft's products. |
.xltx, .xltm | Templates: opening one creates a new, unsaved workbook based on it. |
.xls | The binary format of Excel 97 to 2003, limited to 65,536 rows and 256 columns per sheet. |
| Strict XLSX | A variant of the standard that drops legacy features and uses different XML namespaces. Excel can save it as "Strict Open XML Spreadsheet"; most files are the common Transitional variant. |
| `.ods` | OpenDocument Spreadsheet, the ISO standard used natively by LibreOffice. Also a ZIP of XML, with a different vocabulary. |
| `.csv` | Plain text, one table, no formatting or formulas. Best for moving data between programs. |
Data types
How XLSX stores dates and numbers
A date in an XLSX file is a serial number: the count of days since the start of a date system, with the time of day as the fraction. Noon on day 46296 is 46296.5. Only the cell's number format makes it look like a date.
- The 1900 date system is the default. Day 1 is 1 January 1900. It deliberately treats 1900 as a leap year, which it wasn't, a bug Excel copied from Lotus 1-2-3 so that serial numbers stayed compatible. Day 60 is a 29 February 1900 that never existed.
- The 1904 date system counts from 1 January 1904 and was the default in early Excel for Mac. Serial numbers are 1,462 lower than in the 1900 system. A workbook says which one it uses with
date1904="1"inxl/workbook.xml; code that ignores the flag shows every date 4 years and 1 day early. - Other software often counts from 30 December 1899 instead. That gives the same dates from 1 March 1900 onwards, but not before: LibreOffice shows serial 1 as 31 December 1899.
- Numbers are 64-bit floating point. Excel keeps 15 significant digits, so a 16-digit card or account number loses its last digit. Store identifiers like that as text.
sample-1904-dates.xlsx and sample-workbook.xlsx below hold the same orders. Read both with your code: the dates should match, even though the stored numbers differ by 1,462.
Troubleshooting
Why won't my XLSX file open, or show the right values?
- "The file format or file extension is not valid." The file isn't really an XLSX: often a CSV, an HTML table or an old XLS that was given the
.xlsxextension, or a download that stopped part-way. Check it in a text editor: a real XLSX starts withPK. - "We found a problem with some content." Excel found XML it couldn't read, usually from a program that generated the file, and offers to repair it. The repair removes whatever it couldn't read.
- Formulas show as empty or 0 in a preview. The file was written by code that saved formulas without results. Open it in Excel, Google Sheets or LibreOffice and it calculates.
- Dates come out as numbers like 46296 when read with code. The library returned the raw serial number; convert it with the library's date helper, and check the workbook's date system.
- The file opens read-only with a yellow bar. That's Protected View, which Excel applies to files from the internet and email attachments. Choose Enable Editing if you trust the source.
- The file is far bigger than its data. Formatting applied to whole columns, thousands of unused styles, embedded images and pivot caches all add weight. Saving as
.xlsbor clearing unused formatting usually helps.
How to
How to open, edit and convert an XLSX file
- Without Excel: Excel for the web is free with a Microsoft account. Google Sheets opens XLSX files from Drive and can edit them in place or convert them to a Google Sheet. LibreOffice Calc is free for Windows, macOS and Linux. Numbers opens them on Mac, iPhone and iPad.
- On a phone: the Excel app, Google Sheets and Numbers all open XLSX; many email apps show a read-only preview.
- In a browser: browsers can't display an XLSX themselves, so a link to one downloads the file.
- With code: openpyxl and pandas in Python, SheetJS in JavaScript, Apache POI in Java. Most read the stored formula results but don't calculate formulas themselves.
- To CSV: File, Save As, CSV. Only the active sheet is saved, and formulas are replaced by their values.
- To PDF: File, Save As or Export, PDF. Set the print area first, or wide sheets split across many pages.
Security
Is an XLSX file safe to open?
An .xlsx file can't hold VBA macros, which removes the most common way spreadsheets carry malware. The macro risk sits with .xlsm, .xls and .xlsb files, and current versions of Microsoft 365 block macros in files that came from the internet. Some risks remain:
- Links and external content. Cells can link to websites, and workbooks can pull data from other files or servers. Excel asks before updating external links; only allow it for files you trust.
- Hidden content. Hidden rows, columns and sheets, sheets set to "very hidden" (which Excel's Unhide menu doesn't list), comments, and author names in the document properties all travel with the file. Before sharing a workbook outside your organisation, run Excel's Document Inspector (File, Info, Check for Issues, Inspect Document).
- Formula injection. If your app writes user-supplied text into a spreadsheet, a value starting with
=can become a live formula, the same problem as CSV injection. Write such values as text cells. - Parsing uploads on a server. An XLSX is a ZIP of XML, so a server that reads uploaded workbooks inherits ZIP risks (archive bombs) and XML risks such as XXE. Use a maintained library and limit file size and decompressed size.
Free downloads
Sample XLSX files to download
Free sample XLSX workbooks for testing uploads, previews, spreadsheet libraries and size limits. Each one opens in openpyxl and LibreOffice, and every formula is stored with its calculated result.
Browsers can't show this kind of file in a page. Download it to open it in the app it belongs to.
What's inside sample-workbook.xlsx
Browsers can't preview an XLSX, so download it and open it in Excel, Google Sheets, LibreOffice or Numbers. These are the parts to look for.
Orders sheet: an Excel table
Twelve orders formatted as a table named
OrdersTable, with banded rows and filter buttons, and the header row frozen so it stays in view.Order IDs as text
000184and the rest keep their leading zeros because they are stored as text, not numbers.Dates and currency
The dates are serial numbers with a
yyyy-mm-ddformat; prices use a euro number format. Change the format and the value underneath stays the same.Formulas with cached results
Each line total is
=E2*F2and the totals row usesSUM. Every formula is saved with its result, as Excel does, so previews show numbers, not blanks.Conditional formatting
Quantities of 5 or more are highlighted by a rule, not by fixed colours, so the highlight follows the data if you edit it.
Summary sheet: cross-sheet formulas and a chart
SUMIFformulas read the Orders sheet, and a bar chart shows revenue by product.About sheet and properties
A short description of the file, and document properties (title, author, description) you can see under File, Info.
All sample XLSX files
Sample workbook
sample-workbook.xlsx · 10.1 KB (10,384 bytes)
Three sheets: an orders table with dates, currency, formulas and conditional formatting; a summary with
SUMIFformulas and a bar chart; and an About sheet. Fictional data.- Testing spreadsheet previews and libraries
- Teaching what an Excel workbook contains
Minimal XLSX (5 parts)
sample-minimal.xlsx · 1.6 KB (1,624 bytes)
Written by hand with only the parts a workbook needs: content types, two relationship files, the workbook and one sheet. Two cells use inline strings, one holds a number. No styles, no shared strings.
- Testing parsers against the bare minimum
- Studying the format with `unzip`
Edge cases
sample-edge-cases.xlsx · 9.4 KB (9,632 bytes)
Leading zeros, a 19-digit ID as text and as a number, a boolean, a
#DIV/0!error, dates around the 1900 leap-year bug, a time, a percentage, line breaks, right-to-left text, emoji, a hyperlink, a cell note, merged cells, a 32,767-character cell, and a hidden and a very hidden sheet.- Checking how a library reads unusual cells
- Finding hidden sheets in an inspection tool
1904 date system
sample-1904-dates.xlsx · 10.3 KB (10,508 bytes)
The same workbook as
sample-workbook.xlsx, saved with the 1904 date system (date1904="1"). The dates look identical in Excel; the stored numbers are 1,462 lower.- Testing date conversion in code
- Catching readers that ignore the date system
1 MB XLSX file
sample-1mb.xlsx · 1 MB (1,048,576 bytes)
23,575 rows of fictional data on one sheet, plus a padding cell that brings the file to exactly 1,048,576 bytes (1 MiB).
- Upload and size-limit tests
- Import performance
Ways to test with them
- Size limits:
sample-1mb.xlsxis exactly 1,048,576 bytes, so you can test an upload limit right at the boundary. - Dates in code: read the first order date from
sample-workbook.xlsxandsample-1904-dates.xlsx. Both should be 1 October 2026; a result in 2022 means the 1904 flag was ignored. - Formula results: a previewer or library should show
25in Orders!G2 and255.07in the totals row ofsample-workbook.xlsx, without recalculating. - Hidden data: an inspection or data-loss-prevention tool should report both the hidden and the very hidden sheet in
sample-edge-cases.xlsx. - Minimal input: a well-built reader opens
sample-minimal.xlsxeven though it has no styles or shared strings part.
Free to use for testing, teaching and demos, commercially or not, with no attribution needed. A link back to this page is always appreciated.
Put it online
Have an XLSX file? Give it a link.
Drop an Excel workbook on 99helpers and it gets its own web address. Anyone with the link downloads the file and opens it in Excel, Google Sheets, LibreOffice or Numbers.
Questions
XLSX files, frequently asked
What is an XLSX file?
An Excel workbook in the Office Open XML format, the default since Excel 2007. It's a ZIP archive of XML files that holds sheets, formulas, formatting and charts.
How do I open an XLSX file without Excel?
Use Excel for the web (free with a Microsoft account), Google Sheets, LibreOffice Calc on a computer, or Numbers on Apple devices. All of them open XLSX files and can save or export them as XLSX again.
What's the difference between XLS and XLSX?
XLS is the binary format of Excel 97 to 2003, limited to 65,536 rows. XLSX is the newer ZIP-and-XML format with room for 1,048,576 rows and 16,384 columns per sheet.
What's the difference between XLSX and XLSM?
Only macros. An XLSM can contain VBA macros; an XLSX can't. If you save a workbook with macros as XLSX, Excel removes them.
Should I use XLSX or CSV?
XLSX when people will work with the file in a spreadsheet and need formulas, formatting or several sheets. CSV when another program will import the data, since almost everything reads CSV.
Can an XLSX file contain a virus?
It can't contain macros, the usual carrier. It can still contain links, external data connections and hidden content, so treat unexpected spreadsheets with care and keep Excel up to date.
Why does Excel say the file format or extension is not valid?
The file isn't really an XLSX, or it's damaged. It may be a CSV, HTML or XLS file renamed to .xlsx, or an incomplete download. A real XLSX begins with the letters PK, the ZIP signature.
How many rows can an XLSX file have?
1,048,576 rows and 16,384 columns per sheet, according to Microsoft's Excel specifications. The number of sheets is limited only by memory.
Related formats
Other file types explained
Keep going
Related
Sources
- ECMA-376: Office Open XML file formats
- Library of Congress: XLSX format description
- IANA media type registration for XLSX
- Microsoft: Excel specifications and limits
- Microsoft: Date systems in Excel
- Microsoft: Excel incorrectly assumes that the year 1900 is a leap year
Last reviewed 27 October 2026.