> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fetchhive.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Sheets

> 配置一个使用已连接的 Google 账户从结构化工作流数据创建 Google Sheet 的工作流步骤

# Google Sheets

当你希望工作流步骤从结构化的工作流数据创建电子表格时,请使用 **Google Sheets**。

## 配置

| 选项                                                                                                    | 是否必填 | 说明                                                   |
| ----------------------------------------------------------------------------------------------------- | ---- | ---------------------------------------------------- |
| Name                                                                                                  | 否    | 步骤在工作流画布中的标签。                                        |
| Integration Authorization                                                                             | 是    | 在 **Authentication** 中选择的已连接 Google 账户。              |
| Action                                                                                                | 是    | Google Sheets 操作。当前编辑器显示 **Create Spreadsheet**。     |
| Title                                                                                                 | 是    | 在 **Title** 中输入的值。                                   |
| JSON Data                                                                                             | 是    | 在 **JSON Data (Array of Objects)** 中输入的值。            |
| When the step fails                                                                                   | 否    | 控制此步骤失败时工作流应 **Terminate Workflow** 还是 **Continue**。 |
| 在配置此步骤之前,请在工作区的 **Integrations** 中连接 Google。如果没有可用的活动 Google Sheets 连接,该步骤会显示警告并链接到 **Integrations**。 |      |                                                      |

如果 **Title** 和 **JSON Data (Array of Objects)** 的值应来自起始输入或早前的工作流步骤,请使用其旁边的 **Insert Variable** 按钮。

编辑器直接描述了预期的输入格式:每个对象成为一行,键成为列标题。

## 输出

此步骤将已创建的 Google Sheets 电子表格对象存储为步骤输出。

在后续步骤中使用完整输出引用:

```text theme={null}
{{STEP_IDENTIFIER.output}}
```

如果你想从已创建的电子表格对象中引用特定字段,在测试运行后从变量选择器中插入它:

```text theme={null}
{{step_2.output.spreadsheet_id}}
```

具体键取决于工作流输出中显示的返回 Google Sheets 响应。

## 示例

打开 **Integrations** 并按需连接 Google。

将 **Google Sheets** 添加到你的工作流,并在 **Authentication** 中选择账户。

保持 **Action** 设置为 **Create Spreadsheet**。

在 **Title** 中输入电子表格名称。

在 **JSON Data (Array of Objects)** 中,传入结构化数据,例如:

```json theme={null}
[
  { "Name": "John", "Age": 20 },
  { "Name": "Jane", "Age": 30 }
]
```

当步骤运行时,Fetch Hive 会创建电子表格,使用对象键作为列标题,并将每个对象写为一行。

{/* Add screenshot: Google Sheets step settings with Title and JSON Data field */}

## 备注

* 当前编辑器公开一个 Google Sheets 操作:**Create Spreadsheet**。
* 该 UI 针对对象的 JSON 数组进行了优化,但后端仍可以处理其他输入格式。
* 在将嵌套输出字段接入后续步骤之前测试一次步骤,以便确认返回的响应形状。

另见:[Integrations](../../../workspace/integrations)、[创建和编辑](../../creating-and-editing) 和 [测试与迭代](../../testing-and-iteration)
