> 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/google-service/read-google-sheet.md).

# Read google sheet

Read google sheet là hành động ra lệnh cho kịch bản tự động kết nối với tài khoản Google Drive của bạn để trích xuất và đọc nội dung từ một ô hoặc một vùng dữ liệu trên tệp Google Sheets trực tuyến.

#### Các tham số cấu hình:

* Credential file: Chọn tệp tin xác thực tài khoản Google (tệp tin có đuôi mở rộng là `.json`). Tệp tin này đóng vai trò như một chiếc chìa khóa bảo mật, mục đích dùng để thiết lập kết nối an toàn với hệ thống Google API, xác thực và cấp quyền cho GPM Automate có thể vào đọc/ghi nội dung trên Google Sheet của bạn.
  * *Hướng dẫn chi tiết*: Bạn có thể xem video hướng dẫn cách tạo tệp tin xác thực này tại đây:
* File ID: Mã định danh duy nhất của tệp Google Sheets cần tương tác để hệ thống xác định chính xác tệp cần đọc dữ liệu.
  * *Cách lấy ID*: Khi bạn mở tệp Google Sheet trên trình duyệt, đường dẫn URL sẽ có dạng `https://docs.google.com/spreadsheets/d/abc123xyz_Mã_ID_Nằm_Ở_Đây/edit`. Bạn chỉ cần copy đoạn chuỗi ký tự nằm giữa cụm `/d/` và `/edit` để điền vào ô này.
* Sheet ID: Số thứ tự vị trí của trang tính (Sheet) cần đọc bên trong tệp (được tính bắt đầu từ số `0` cho sheet đầu tiên bên trái, tiếp theo lần lượt là 1, 2, 3... từ trái qua phải).
* Column Name or Index: Chỉ định vị trí cột cần đọc dữ liệu. Bạn có thể nhập theo 2 cách:
  * *Theo tên chữ cái*: Nhập tên cột bắt đầu từ `A`, `B`, `C`, `D`...
  * *Theo số thứ tự (Index)*: Nhập số thứ tự bắt đầu từ số `1` (tương ứng với cột 1 là cột A).
* Row Index: Số thứ tự của hàng cần đọc dữ liệu, được tính bắt đầu từ số `1` (tương ứng với hàng số 1 trên Google Sheet).
* Output variable: Tên biến số của GPM Automate dùng để hứng và lưu trữ lại giá trị nội dung văn bản đọc ra được từ ô tính đó.

#### Ví dụ thực tế: Tự động lấy dữ liệu tài khoản từ Google Sheet để điền Form

Khi bạn lưu trữ danh sách hàng loạt tài khoản MMO (gồm Username, Password) trên một tệp Google Sheet dùng chung, và muốn kịch bản tự động đọc dòng đầu tiên để lấy dữ liệu ra xử lý:

* Cách cấu hình để lấy Username ở ô A1:
  * Credential file: Chọn đường dẫn đến file `client_secret_....json` đã cấu hình.
  * File ID: Nhập mã ID tệp Sheet của bạn.
  * Sheet ID: `0` (Đọc ở sheet đầu tiên).
  * Column Name or Index: Điền `A` (hoặc điền `1`).
  * Row Index: Điền `1`.
  * Output variable: `currentUsername`
* Kết quả: GPM Automate sẽ ngầm kết nối tới Google Sheet, bóc tách dữ liệu tại ô A1 và nạp thẳng nội dung chữ vào biến `$currentUsername`. Sau đó, bạn có thể gọi biến này ra ở hành động nhập liệu Key press một cách mượt mà.

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

<figure><img src="/files/n12HARmJyltDdec9VcaX" 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/google-service/read-google-sheet.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.
