

# 从 Google Sheets 实体读取内容
<a name="googlesheets-reading-from-entities"></a>

 **先决条件** 
+  要从中读取内容的 Google 电子表格。需要电子表格的 SpreadSheet ID 和 tabName。

 **Google Sheets 实体和字段详细信息：**


| 实体 | 数据类型 | 支持的运算符 | 
| --- | --- | --- | 
| 电子表格 | 字符串 | N/A（不支持筛选） | 

 **示例** 

```
googleSheets_read = glueContext.create_dynamic_frame.from_options(
    connection_type="googlesheets",
    connection_options={
        "connectionName": "connectionName",
        "ENTITY_NAME": "{SpreadSheetID}#{SheetTabName}",
        "API_VERSION": "v4"
    }
```

 **对查询进行分区** 

 仅对于基于记录的分区，如果想在 Spark 中利用并发性，可以将 `NUM_PARTITIONS` 作为附加 Spark 选项。使用此参数，原始查询将被拆分为 `NUM_PARTITIONS` 个子查询，这些子查询可以由 Spark 任务同时执行。

 **使用 `NUM_PARTITIONS` 的示例** 

```
googlesheets_read = glueContext.create_dynamic_frame.from_options(
    connection_type="googlesheets",
    connection_options={
        "connectionName": "connectionName",
        "ENTITY_NAME": "{SpreadSheetID}#{SheetTabName}",
        "API_VERSION": "v4",
        "NUM_PARTITIONS": "10"
    }
```