> For the complete documentation index, see [llms.txt](https://docs.gpmautomate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gpmautomate.com/automate-zh/cao-zuo-zhi-nan/file-and-folder/append-excel-file.md).

# 追加Excel文件

附加 Excel 文件是一个智能操作，用于自动查找数据表末尾的第一个空行，并将内容追加到该行，帮助您无需手动计算或管理行号 (`Row Index`)。

#### 配置参数：

* 文件路径：指向需要插入数据的 Excel 文件的绝对路径（例如：`D:\GPM\data.xlsx`）。
* 工作表索引：需要写入数据的工作表的位置，从 0 开始计算 *(第一个工作表为 `0`)*。
* 列名称或索引：需要写入数据的列的位置。您可以通过两种方式填写：
  * 按字母字符名称：`A`，`B`，`C`，`D`...
  * 按索引数字，从 1 开始计算 *(列 A 为 `1`，列 B 为 `2`...)*。
* 值：您希望写入该列最后一个空单元格的文本内容（或包含数据的变量）。

#### 实际示例：从第 6 行开始将内容追加到 B 列

假设您有一个 Excel 文件，当前数据列表的第 1 行到第 5 行已经有内容。您希望配置一个自动脚本，将一个新数据（例如刚刮出的优惠券代码）填入 B 列的下一个空单元格（即单元格 `B6`）。

您只需配置附加 Excel 文件操作，如下所示：

* 配置方式：
  * 文件路径：`D:\GPM\data.xlsx`
  * 工作表索引：`0`
  * 列名称或索引：`B` *(选择需要追加数据的 B 列)*。
  * 值：填写字符串内容（或传递包含数据的变量，例如优惠券变量 `$couponCode`）。

结果：系统将自动从上到下扫描 B 列，识别出第 1 行到第 5 行已有数据，并立即将变量的值写入第一个空行（第 6 行 - 单元格 `B6`）。在脚本的下一次运行中，新数据将再次自动推送到第 7 行 (`B7`)、第 8 行 (`B8`)... 以顺序和准确的方式进行。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.gpmautomate.com/automate-zh/cao-zuo-zhi-nan/file-and-folder/append-excel-file.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
