> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/creator/content-creator-zh/jiao-cheng-yu-shi-li/external-services/spreadsheet-data.md).

# 来自电子表格的数据

由 Google Sheet 驱动的场景内容，无需重新部署即可更新。

通过 Google 表格驱动场景内容。编辑表格即可更改艺术家名称、视频流和推荐的可穿戴设备，无需重新部署场景。

## 项目信息

**维护者：** Decentraland

[查看源代码](https://github.com/decentraland/Read_Spreadsheet_Scene)

**许可证：** [Apache-2.0](https://github.com/decentraland/Read_Spreadsheet_Scene/blob/main/LICENSE)。复用前请查看上游许可条款；代码和资源可能适用不同的条款。

## 探索代码

这些链接指向特定的源代码快照，因此随着上游持续开发，这些说明仍然有用。它们是学习参考资料，并非安全评估。

### 以 JSON 格式读取已发布的 Google 表格

`getSpreadsheetData` 通过 Google Visualization 端点（`gviz/tq?tqx=out:json`）请求表格，移除 `setResponse(...)` 包装层，并将每一行转换为以列标题为键的对象。

**项目背景：** 必须将表格设为任何拥有链接的人都可以查看。 `gid` 用于选择工作表标签页，而 `headers=1` 表示将第一行视为列名。

**源代码参考：**

* [`getSpreadsheetData`](https://github.com/decentraland/Read_Spreadsheet_Scene/blob/57bb4086aed3054d69a74f33f20f2d86c4eb9bb6/src/scheduler.ts#L1-L47)

### 将一行数据应用到场景

`updateFromSpreadsheet` 读取一行数据，并更新横幅 `TextShape`，替换屏幕上的 `VideoPlayer` 视频源，替换分发器上展示的可穿戴设备，并将分发器的点击操作指向该行的购买链接。

**项目背景：** 列名，例如 `NowPlaying`, `VideoURL`, `WearableURN`和 `BuyURL` ，必须与表格中的标题一致。实体会根据 Creator Hub 场景中指定的名称进行查找。

**源代码参考：**

* [`updateFromSpreadsheet`](https://github.com/decentraland/Read_Spreadsheet_Scene/blob/57bb4086aed3054d69a74f33f20f2d86c4eb9bb6/src/index.ts#L10-L64)
* [`createWearable`](https://github.com/decentraland/Read_Spreadsheet_Scene/blob/57bb4086aed3054d69a74f33f20f2d86c4eb9bb6/src/index.ts#L100-L130)

### 通过 Creator Hub 按钮循环切换各行数据

`main` 会监听 `Next` 和 `Previous` 在 `Switch Artist` 实体上的操作，并让行索引在下载的数据范围内循环。

**项目背景：** 使用 `getActionEvents` ，该方法来自 `@dcl/asset-packs`，因此需要在 Creator Hub 中为该实体配置相应操作。

**源代码参考：**

* [`main`](https://github.com/decentraland/Read_Spreadsheet_Scene/blob/57bb4086aed3054d69a74f33f20f2d86c4eb9bb6/src/index.ts#L69-L97)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.decentraland.org/creator/content-creator-zh/jiao-cheng-yu-shi-li/external-services/spreadsheet-data.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
