Skip to main content

Microsoft Excel - Alteryx 驱动程序

Alteryx 内置了 Microsoft Excel 的本地读写驱动程序。在 Alteryx Designer 中读写 .xlsx 工作表无需安装驱动程序或进行其他系统配置。

配置

通过 Alteryx 驱动程序可用于 Microsoft Excel (.xlsx) 文件的输出数据工具中的文件格式选项提供以下功能:

  • 创建新的工作表

  • 覆盖文件(移除)

  • 覆盖工作表(删除)

  • 附加到现有工作表

长度和限制

在读取和写入 .xlsx 文件时,Alteryx 驱动程序完全支持已经记录的 Excel 行数和列数限制。

最大行数(Excel 规定的限制)

1,048,575

最大列数(Excel 规定的限制)

16,384

列名称长度和字段名称限制

建议使用 256,以便与其他格式兼容

超出记录限制(1,048,575 行和 16,384 列)

超出列限制会导致错误,超出行限制会导致文件被截断

超出文件大小限制(4,294,967,295 字节,大约 4GB)

显示错误信息:“要写入至表格的数据太大。正在中止进程。”

数据类型

Alteryx 驱动程序会分析工作表数据,以确定每列的数据类型和字段名称。

解析数据类型

如果某一列中有多种数据类型,则该列的数据类型将设置为 String/WString。

字符串值

尽可能返回窄字符串。

数字舍入

指定给单元格的格式将被忽略。例如,如果一个单元格中包含数值 1.27952,并且该单元格的格式设置为显示小数点后 2 位,则系统将返回完整的数值 1.27952,而不是 1.28。

日期、时间和日期时间

所有“日期”和“时间”都以 Alteryx 格式显示。“日期”数据类型的格式将取决于对列中数据的分析。

  • 如果列中的每个值都只是日期(例如 2014/11/04 或 5 月 4 日,没有时间部分),则数据类型将设置为“日期”,即 YYYY-MM-DD。

  • 如果列中的每个值只包含时间信息而没有日期部分,则数据类型将设置为“时间”,即 HH:MM:SS。

  • 如果列中的数据值同时包含数据和时间部分,则数据类型将被设置为“日期时间”,即 YYYY-MM-DD HH:MM:SS。

  • 自定义日期格式将被忽略。应用于 Excel 中日期的任何自定义格式都会被忽略,Alteryx 只分析实际数据值。例如,某个单元格包含完整的日期和时间值,但格式设置为仅显示日期或时间,Alteryx 将忽略该格式设置,只评估该单元格包含的原始数据值。如果使用了自定义格式来显示或隐藏部分日期/时间值,这可能会导致意外结果。

字段名称

  • Duplicate field/column names: The following column names in the original Excel file: abc, abc, abc, 123, 123, and 123 are read as: abc, abc2, abc3, 123, 123_2, and 123_3.

  • Column names formatted as dates: Column names formatted as dates in the original Excel file (for example, 1/1/2014, 2/1/2014, 3/1/2014) generate column names formatted using the default Alteryx date format: 2014-01-01, 2014-02-01, 2014-03-01.

  • Special characters in sheet and range names: Alteryx now supports all characters supported by Excel for sheet names. If Excel allows a character to be used when naming a sheet, the new driver can read it and does not convert or change any characters.

    These characters are not valid for sheet names: \, /, ?, *, [, and ].

Formatting in Empty Column Cells

Formatting (for example, borders) applied to empty cells can make a row appear present in Alteryx. This affects column header detection. Use the "Start Data Import on Line" option or ensure consistent formatting and avoid unexpected behavior.

公式错误

当工作表中的公式出错时,Alteryx 将为非字符串类型的字段返回一个 NULL 值,为字符串类型的字段返回实际错误字符串。

范围

用于 Microsoft Excel 的 Alteryx 驱动程序提供以下功能:

  • 支持读取命名范围和显式范围。

  • 支持写入显式范围。支持覆盖命名范围,但不能创建新的范围。

注意

Alteryx 支持在覆盖期间保留单元格格式(不包括模板)。

数据输出工作表名称

用于 Microsoft Excel 的 Alteryx 驱动程序支持读取工作表名称列表。

Dates and Excel

Date-Time Precision

While Alteryx now supports date-time precision to sub-seconds, the same high-precision date-time (date-time data with a higher resolution than seconds) is not supported in XLSX. If you attempt to write high-precision date-time data from Alteryx to XLSX, you will receive a Field Conversion Error that indicates that your high-precision date is truncated to seconds, for example:

High precision Time is not supported in XLSX and values are truncated to seconds: field "@1".

There are a couple of options you might consider:

  • As a potential workaround, you might consider formatting your date-time data as a string before you write to XLSX. This allows Excel formulas to work with the data, though fractional seconds are ignored.

  • Alternatively, you can use a Select tool to truncate your date-time data and avoid triggering the above warning in Alteryx.

Dates Prior to 1900

Excel does not support dates before 1900. Calculations involving dates from Jan 1, 1900, to Mar 1, 1900, produce incorrect results. For more information on this issue, go to Microsoft documentation.

FileTables 支持

Alteryx 驱动程序支持读写 Microsoft SQL Server FileTable 中的 Excel 文件,方法是浏览 FileTable 的 UNC 路径,并对文件进行映射(就像存储在网络驱动器上的文件一样)。要将 Excel 文件写入 Microsoft SQL Server FileTable,必须在输出工具中选中格式特定选项启用 SQL Server FileTable 支持

XLSX 写入支持的输出选项

  • Create New Sheet

    • If a file exists, a new sheet is created. If there is already a sheet with the same name, an error displays.

    • If a file doesn't exist, a new file and sheet are created.

  • Append to Existing Sheet

    • If a file exists, data is written in the specified sheet. If the specified sheet doesn’t exist, there is an error.

    • If a file doesn't exist, data is not written.

  • Overwrite Sheet or Range

    • If a file exists, the specified sheet is deleted if it exists, and then data is written in a new sheet with the specified name.

    • If a file doesn't exist, a new file and sheet are created.

  • Overwrite File (Remove)

    • If a file exists, the file is deleted, and data is written in a new sheet in a new file.

    • If a file doesn't exist, a new file and sheet are created.

使用范围时的 XLSX 写入支持的其他信息

创建工作表/覆盖文件

附加工作表

覆盖工作表

可以使用显式范围。

无法使用命名范围,因为命名范围与工作表绑定,而工作表不存在。

显式范围和命名范围都可以使用。

必须事先为工作表定义命名范围。

显式范围和命名范围都可以使用。

必须事先为工作表定义命名范围。

数据包含的列数不能超过指定范围,但可以少于指定范围。

如果传入的数据不足以填满范围,则列将被填入 null。

数据包含的列数不能超过指定范围,但可以少于指定范围。

如果该范围内的传入列较少,则未映射的列将被填入 null。

数据包含的列数不能超过指定范围,但可以少于指定范围。

如果传入的数据不足以填满范围,则列将被填入 null。

数据从指定范围第一行的左上角单元格开始写入。

数据将从原始数据之后的第一个可用行开始附加。附加时,不会覆盖任何现有数据。

无法将数据写入包含合并单元格的工作表。

列名应包含在范围中。如果范围中的第一行为空,则范围中包含数据的第一行将被用作列名。如果列名与传入数据不匹配,则必须使用输出数据工具中的“自定义附加映射器”手动将其映射到输出名称。

数据从指定范围第一行的左上角单元格开始写入。

无法将数据写入包含合并单元格的工作表

数据包含的行数可以超过指定范围。

数据将写入指定范围之外,直至:

  • 所有数据都被写入

  • 超过最大行数 (1,048,575)

数据包含的行数可以超过指定范围。

数据将写入指定范围之外,直至:

  • 所有数据都被写入

  • 超过最大行数 (1,048,575)

数据包含的行数可以超过指定范围。

数据将写入指定范围之外,直至:

  • 所有数据都被写入

  • 超过最大行数 (1,048,575)

  • 遇到现有数据