Convert XLSX to TOML
Max file size 100mb.
XLSX vs TOML Format Comparison
| Aspect | XLSX (Source Format) | TOML (Target Format) |
|---|---|---|
| Format Overview |
XLSX
Office Open XML Spreadsheet
XLSX is the default file format for Microsoft Excel since 2007. Based on the Office Open XML (OOXML) standard (ISO/IEC 29500), it stores spreadsheet data in a ZIP-compressed XML package. XLSX supports multiple worksheets, formulas, charts, pivot tables, conditional formatting, data validation, and rich cell formatting including fonts, colors, and borders. Spreadsheet Office Open XML |
TOML
Tom's Obvious Minimal Language
TOML is a minimal configuration file format designed to be easy to read due to its clear semantics. Created by Tom Preston-Werner (co-founder of GitHub), TOML maps unambiguously to a hash table and supports native data types including strings, integers, floats, booleans, dates, arrays, and tables. It uses [[array]] syntax for arrays of tables, making it ideal for representing tabular data as structured configuration. Configuration Data Serialization |
| Technical Specifications |
Structure: ZIP container with XML content (Office Open XML)
Encoding: UTF-8 XML within ZIP archive Standard: ISO/IEC 29500 (ECMA-376) Max Rows: 1,048,576 rows per sheet Extensions: .xlsx |
Structure: Plain text key-value pairs with sections
Encoding: UTF-8 (required by specification) Specification: TOML v1.0.0 (2021) Data Types: String, Integer, Float, Boolean, DateTime, Array, Table Extensions: .toml |
| Syntax Examples |
XLSX stores data in structured XML cells: Sheet1: A1: Name B1: Role C1: Department A2: Alice B2: Engineer C2: R&D A3: Bob B3: Designer C3: UX A4: Carol B4: Manager C4: Operations (Formatted cells with styles and data types) |
TOML represents rows as arrays of tables: [[row]] Name = "Alice" Role = "Engineer" Department = "R&D" [[row]] Name = "Bob" Role = "Designer" Department = "UX" [[row]] Name = "Carol" Role = "Manager" Department = "Operations" |
| Content Support |
|
|
| Advantages |
|
|
| Disadvantages |
|
|
| Common Uses |
|
|
| Best For |
|
|
| Version History |
Introduced: 2007 (Office 2007, replacing .xls)
Standard: ECMA-376 (2006), ISO/IEC 29500 (2008) Status: Industry standard, active development MIME Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
Introduced: 2013 by Tom Preston-Werner
v1.0.0: Released January 2021 Status: Stable specification, growing adoption MIME Type: application/toml |
| Software Support |
Microsoft Excel: Native format (full support)
Google Sheets: Full import/export support LibreOffice Calc: Full support Other: Python (openpyxl), Apache POI, SheetJS |
Python: tomllib (stdlib 3.11+), tomli, toml
Rust: toml crate (Cargo uses TOML natively) Go: BurntSushi/toml, pelletier/go-toml Editors: VS Code, IntelliJ, Sublime Text (with plugins) |
Why Convert XLSX to TOML?
Converting XLSX to TOML enables you to transform Excel spreadsheet data into structured configuration files that can be consumed by modern applications and tools. TOML's [[array]] syntax maps naturally to spreadsheet rows, where each row becomes a table entry with column headers as keys and cell values as typed values.
This conversion is particularly useful when you manage configuration data in Excel for convenience but need to deploy it as TOML configuration files. Many modern tools use TOML as their configuration format, including Rust's Cargo, Python's pyproject.toml, and static site generators like Hugo and Zola. Converting your spreadsheet data to TOML bridges the gap between business-friendly Excel and developer-friendly configuration.
TOML's strong type system is another advantage. Unlike formats that treat everything as strings, TOML natively supports integers, floats, booleans, and dates. When converting from XLSX, numeric values remain as numbers and date values are preserved in RFC 3339 format, ensuring proper interpretation by consuming applications.
Our converter reads the XLSX workbook, extracts data from the first sheet, and generates a TOML file using arrays of tables ([[row]]) where each spreadsheet row becomes a TOML table with properly typed key-value pairs derived from the column headers.
Key Benefits of Converting XLSX to TOML:
- Configuration Ready: Output can be used directly as application configuration
- Typed Values: Numbers, booleans, and dates are preserved with proper TOML types
- Human-Readable: Clear key-value syntax that is easy to read and edit
- Tool Integration: Compatible with Cargo, pyproject.toml, Hugo, and other TOML consumers
- Version Control: Plain text format produces meaningful diffs in Git
- Comment Support: Add explanatory comments after conversion for documentation
Practical Examples
Example 1: Employee Directory
Input XLSX file (employees.xlsx):
Excel Spreadsheet - Sheet1: +--------+-----------+-------------+--------+ | Name | Title | Department | Ext | +--------+-----------+-------------+--------+ | Alice | Engineer | R&D | 1201 | | Bob | Designer | UX | 1305 | | Carol | Manager | Operations | 1102 | +--------+-----------+-------------+--------+
Output TOML file (employees.toml):
[[row]] Name = "Alice" Title = "Engineer" Department = "R&D" Ext = 1201 [[row]] Name = "Bob" Title = "Designer" Department = "UX" Ext = 1305 [[row]] Name = "Carol" Title = "Manager" Department = "Operations" Ext = 1102
Example 2: Application Settings
Input XLSX file (settings.xlsx):
Excel Spreadsheet - Sheet1: +------------------+-----------------+----------+---------+ | Parameter | Value | Type | Default | +------------------+-----------------+----------+---------+ | max_connections | 100 | integer | 50 | | timeout_seconds | 30 | integer | 60 | | debug_mode | false | boolean | true | | log_level | info | string | warning | +------------------+-----------------+----------+---------+
Output TOML file (settings.toml):
[[row]] Parameter = "max_connections" Value = 100 Type = "integer" Default = 50 [[row]] Parameter = "timeout_seconds" Value = 30 Type = "integer" Default = 60 [[row]] Parameter = "debug_mode" Value = "false" Type = "boolean" Default = "true" [[row]] Parameter = "log_level" Value = "info" Type = "string" Default = "warning"
Example 3: Server Inventory
Input XLSX file (servers.xlsx):
Excel Spreadsheet - Sheet1: +----------+----------------+------+-------+-----------+ | Hostname | IP Address | CPU | RAM | OS | +----------+----------------+------+-------+-----------+ | web-01 | 192.168.1.10 | 4 | 16 GB | Ubuntu 22 | | db-01 | 192.168.1.20 | 8 | 64 GB | CentOS 9 | | cache-01 | 192.168.1.30 | 2 | 8 GB | Debian 12 | +----------+----------------+------+-------+-----------+
Output TOML file (servers.toml):
[[row]] Hostname = "web-01" IP_Address = "192.168.1.10" CPU = 4 RAM = "16 GB" OS = "Ubuntu 22" [[row]] Hostname = "db-01" IP_Address = "192.168.1.20" CPU = 8 RAM = "64 GB" OS = "CentOS 9" [[row]] Hostname = "cache-01" IP_Address = "192.168.1.30" CPU = 2 RAM = "8 GB" OS = "Debian 12"
Frequently Asked Questions (FAQ)
Q: What is TOML format?
A: TOML (Tom's Obvious Minimal Language) is a configuration file format created by Tom Preston-Werner in 2013. It is designed to be easy to read and write, with clear semantics that map unambiguously to a hash table. TOML supports native data types (strings, integers, floats, booleans, dates), nested tables, and arrays of tables, making it popular for application configuration files like Cargo.toml and pyproject.toml.
Q: Which worksheet is converted from the XLSX file?
A: The converter processes the first (active) worksheet in the XLSX workbook. If your file contains multiple sheets, the data from the first sheet will be extracted and converted into TOML arrays of tables. You can reorder sheets in Excel before conversion if you need a different sheet converted.
Q: How are data types handled in the conversion?
A: The converter attempts to preserve data types from the Excel file. Numeric cells are written as TOML integers or floats, and text cells become TOML strings (quoted). Date values are converted to RFC 3339 format as TOML supports native date/time types. Boolean-like values may be represented as strings unless explicitly typed in the source data.
Q: Are Excel formulas preserved in the TOML output?
A: TOML does not support formulas or calculations. The converter extracts the computed values from formula cells and includes the results as appropriately typed TOML values. The formula expressions themselves are not transferred to the output.
Q: What does the [[row]] syntax mean?
A: In TOML, [[row]] defines an array of tables. Each [[row]] block represents one element in the array, corresponding to one row from your spreadsheet. This is TOML's way of representing repeated structured records, similar to an array of objects in JSON. The key-value pairs within each block correspond to column values for that row.
Q: Can I use the output with Python's tomllib?
A: Yes, the generated TOML is fully compliant with the TOML v1.0.0 specification and can be parsed by Python's built-in tomllib module (Python 3.11+) or the tomli third-party library. The data will be loaded as a dictionary with a "row" key containing a list of dictionaries.
Q: How are column headers with spaces handled?
A: TOML keys can contain most characters, but spaces in keys require quoting. Column headers with spaces are either converted to use underscores (e.g., "IP Address" becomes "IP_Address") or quoted in the TOML output to maintain valid syntax while preserving the original header meaning.
Q: How does the converter handle large spreadsheets?
A: The converter processes spreadsheets of any reasonable size. Each row becomes a [[row]] table entry in the TOML output, so large spreadsheets produce proportionally larger TOML files. The output remains well-structured and parseable regardless of size, though very large files may be better suited to CSV or JSON formats for data exchange.