XLSX-MS Office开放XML电子表格

司机简称

XLSX

生成依赖项

libexpat公司

此驱动程序可以读取、写入和更新Microsoft Office Open XML(也称为OOXML)电子表格格式的电子表格,由Microsoft Office 2007及更高版本的应用程序生成。LibreOffice/OpenOffice也可以从v3版本导出这种格式的文档。

只有在针对Expat库编译GDAL/OGR时,驱动程序才可用。

每一页都显示为OGR层。没有直接可用的几何支持(但您可以使用OGR VRT功能)。

注意1:根据生成文件的应用程序,驱动程序可能成功检索公式的结果,也可能失败。有些应用程序在文档中写入公式的计算结果,在这种情况下,驱动程序将能够检索它。否则将返回原始公式字符串。

注2:不支持带有密码的电子表格。

注3:更新现有文档时,OGR无法理解的所有现有样式、格式、公式和其他概念(图表、图形、宏等)都将丢失:文档是从OGR数据模型从头开始重新编写的。

驱动程序功能

Supports Create()

This driver supports the GDALDriver::Create() operation

Supports VirtualIO

This driver supports virtual I/O operations (/vsimem/, etc.)

配置选项

The following configuration options are available:

  • 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