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

# Write google sheet

Write google sheet 是一个命令，指示自动化脚本连接到您的 Google Drive 帐户，以覆盖或插入新内容到在线 Google Sheets 中的特定单元格。

#### 配置参数：

* Credential file: 选择 Google 帐户的凭证文件（`.json` 文件）。这是授予 GPM Automate 连接、验证并执行将内容写入您的 Google 表格的安全凭证。
  * *创建文件的指南*: 在这里查看视频教程：
* File ID: 需要交互的 Google Sheets 文件的唯一标识符（从文件的 URL 中 `/d/` 和 `/edit` 之间的字符串获取）。
* Sheet ID: 需要写入内容的工作表的序号（从左到右，第一张工作表从 `0` 开始）。
* Column Name or Index: 指定需要写入数据的列位置。您可以输入字母（例如：`A`、`B`、`C`...）或输入索引的数字（例如：`1` 对应于列 A）。
* Row Index: 需要写入数据的行号，从 `1` 开始计算。
* Value: 您想要填入目标单元格的文本、数字或来自 GPM Automate 变量的值。

#### 实际示例：在运行完成后自动更新帐户状态

当您执行帐户养护或发布时，在一个 Profile 成功完成任务后，您希望在 Google 表格的状态列中写入“Live”或“成功”以便于跟踪：

* 配置以写入单元格 C2 的方法：
  * Credential file: 选择配置好的 `client_secret_....json` 文件的路径。
  * File ID: 输入您的 Sheet 文件 ID。
  * Sheet ID: `0`（写入第一张工作表）。
  * Column Name or Index: 填写 `C`（或填写 `3`）。
  * Row Index: 填写 `2`。
  * Value: 填写文本 `Live`（或传递状态变量 `$status`）。
* 结果：GPM Automate 将立即同步并快速将“Live”直接填入您在线 Google 表格的 C2 单元格，而无需打开 Docs 浏览器。

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

<figure><img src="/files/8Wku6Bc473rpEf0VMWIz" 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/cao-zuo-zhi-nan/google-service/write-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.
