XLSX - MS Office Open XML spreadsheet
Driver short name
This driver can read, write and update spreadsheets in Microsoft Office Open XML (a.k.a. OOXML) spreadsheet format, generated by applications like Microsoft Office 2007 and later versions. LibreOffice/OpenOffice can also export documents in that format since their v3 version.
The driver is only available if GDAL/OGR is compiled against the Expat library.
Each sheet is presented as a OGR layer. No geometry support is available directly (but you may use the OGR VRT capabilities for that).
Note 1 : depending on the application that produced the file, the driver might succeed or not in retrieving the result of formulas. Some applications write the evaluated result of formulas in the document, in which case the driver will be able to retrieve it. Otherwise the raw formula string will be returned.
Note 2 : spreadsheets with passwords are not supported.
Note 3 : when updating an existing document, all existing styles, formatting, formulas and other concepts (charts, drawings, macros, …) not understood by OGR will be lost : the document is re-written from scratch from the OGR data model.
This driver supports the
This driver supports virtual I/O operations (/vsimem/, etc.)
OGR_XLSX_HEADERS = FORCE / DISABLE / AUTO : By default, the driver will read the first lines of each sheet to detect if the first line might be the name of columns. If set to FORCE, the driver will consider the first line will be taken as the header line. If set to DISABLE, it will be considered as the first feature. Otherwise auto-detection will occur.
OGR_XLSX_FIELD_TYPES = STRING / AUTO : By default, the driver will try to detect the data type of fields. If set to STRING, all fields will be of String type.
Transform CSV file input.csv to an Office Open XML file output.xlsx. The spreadsheet will contain one sheet with name “input”.
ogr2ogr -f "XLSX" output.xlsx input.csv
Add the contents of CSV file input2.csv to the OOXML file output.xlsx created in the first example. The spreadsheet will now contain two sheets, “input” and “input2”.
ogr2ogr -f "XLSX" output.xlsx -update input2.csv