> 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/huong-dan-cac-action/file-and-folder/append-excel-file.md).

# Append excel file

Append excel file là hành động thông minh dùng để tự động tìm kiếm hàng trống đầu tiên ở cuối bảng dữ liệu và ghi nối tiếp nội dung vào đó, giúp bạn không cần phải tính toán hay quản lý số thứ tự hàng (`Row Index`) thủ công.

🎥 Xem thêm video hướng dẫn: [Tại đây](https://youtu.be/EH7olDLAb9c).

#### Tham số cấu hình:

* File Path: Đường dẫn tuyệt đối dẫn đến file Excel cần chèn thêm dữ liệu (Ví dụ: `D:\GPM\data.xlsx`).
* Sheet index: Vị trí của trang tính (sheet) cần ghi dữ liệu, bắt đầu tính từ 0 *(Sheet đầu tiên là `0`)*.
* Column Name or Index: Vị trí cột cần ghi dữ liệu. Bạn có thể điền theo hai cách:
  * Theo tên ký tự chữ cái: `A`, `B`, `C`, `D`...
  * Theo số mục chỉ số, bắt đầu tính từ 1 *(Cột A là `1`, cột B là `2`...)*.
* Value: Nội dung văn bản (hoặc biến chứa dữ liệu) mà bạn muốn ghi vào ô trống cuối cùng của cột đó.

#### Ví dụ thực tế: Ghi nối tiếp nội dung vào cột B từ dòng thứ 6 trở đi

Giả sử bạn đang có một file Excel chứa danh sách dữ liệu hiện tại đã có chữ từ hàng 1 đến hàng 5. Bạn muốn cấu hình kịch bản tự động điền thêm một dữ liệu mới (ví dụ một mã coupon vừa cào được) vào ô trống tiếp theo của cột B (chính là ô `B6`).

Thay vì phải dùng hành động đọc file để đếm xem dòng nào trống rồi mới dùng lệnh *Write excel file*, bạn chỉ cần cấu hình hành động Append excel file như sau:

* Cách cấu hình:
  * File Path: `D:\GPM\data.xlsx`
  * Sheet index: `0`
  * Column Name or Index: `B` *(Chọn cột B cần nối tiếp dữ liệu)*.
  * Value: Điền nội dung chuỗi (hoặc truyền biến chứa dữ liệu, ví dụ biến mã coupon `$couponCode`).

Kết quả: Hệ thống sẽ tự động quét cột B từ trên xuống dưới, nhận diện được từ hàng 1 đến hàng 5 đã có dữ liệu, và lập tức ghi giá trị của biến vào ngay hàng trống đầu tiên (hàng 6 - ô `B6`). Ở lượt chạy tiếp theo của kịch bản, dữ liệu mới sẽ lại tự động được đẩy xuống hàng 7 (`B7`), hàng 8 (`B8`)... một cách tuần tự và chính xác.

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

<figure><img src="/files/s6X35X468y4WOFSqlRCJ" 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/huong-dan-cac-action/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.
