> 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/action-shi-yong-zhi-nan/file-and-folder/append-excel-file.md).

# Append excel file

Append excel file 是一个智能操作，用于自动查找数据表末尾的第一个空白行，并将内容连续写入其中，让您不需要手动计算或管理行号（`Row Index`）。

🎥 观看更多操作视频：[点击这里](https://youtu.be/EH7olDLAb9c)。

#### 配置参数：

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

#### 实际示例：从第 6 行开始向 B 列连续写入内容

假设您有一个 Excel 文件，其中现有数据列表已经从第 1 行到第 5 行填有内容。您想配置自动脚本，将新数据（例如刚刚抓取到的优惠券代码）填入 B 列的下一个空白单元格（即 `B6` 单元格）。

无需先使用读取文件操作来统计哪一行为空，再使用 *Write excel file* 命令，您只需按如下方式配置 Append excel file 操作即可：

* 配置方式：
  * File Path：`D:\GPM\data.xlsx`
  * Sheet index：`0`
  * Column Name or Index：`B` *(选择需要连续写入数据的 B 列)*。
  * Value：填写字符串内容（或传入包含数据的变量，例如优惠券代码变量 `$couponCode`）。

结果：系统将自动从上到下扫描 B 列，识别出第 1 行到第 5 行已有数据，并立即将变量的值写入第一个空白行（第 6 行 - `B6` 单元格）。在脚本下一次运行时，新数据将再次自动依次准确地写入第 7 行（`B7`）、第 8 行（`B8`）……

<figure><img src="/files/V5Jr3EmGfie1KK3zLvfU" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/5BW7DI3SeiA9qBsYiLSy" alt=""><figcaption></figcaption></figure>


---

# 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/action-shi-yong-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.
