如何通过API得到spreadsheetsheetid?
How to get spreadsheet sheet id through API?
我正在尝试从特定目录中的 google sheets(大约 570 sheets)列表中删除多余的行和列(已知范围)。
我能够使用 google 驱动器 API 获得传播 sheet ID。但是,修改页面的尺寸需要 sheet ID。
我找不到通过驱动器 API(文件属性)检索此 sheet ID 的方法,也找不到任何关于如何列出可用 sheets 在价差内sheet 鉴于我有价差sheet Id.
我尝试使用 google 应用程序脚本来实现我的目标,但是 运行 时间已经超过了允许的限制(5 分钟),即使在用尽了所有优化代码的可能性之后。
可以空着spreadsheets.get() to get all the sheets id available in your spreadsheet. You just need to provide the spreadsheet id
in your path parameters, you can leave the query parameters使用。
它将return一个Spreadsheet Resource which contains sheets information under sheets
-> properties
field. See Sheets Object Resource
示例电子表格:
使用 API 资源管理器的示例请求:
响应示例:
{
"spreadsheetId": "1RPQ7WOTOZZSirf60kP6nULhViCdsuGHcOVoUxxxx",
"properties": {
"title": "NewSheet",
......
},
......
"sheets": [
{
"properties": {
"sheetId": 0,
"title": "Sheet1",
"index": 0,
"sheetType": "GRID",
"gridProperties": {
"rowCount": 1000,
"columnCount": 26
}
}
},
{
"properties": {
"sheetId": 500406870,
"title": "Sheet2",
"index": 1,
"sheetType": "GRID",
"gridProperties": {
"rowCount": 1000,
"columnCount": 26
}
}
}
],
}
我正在尝试从特定目录中的 google sheets(大约 570 sheets)列表中删除多余的行和列(已知范围)。
我能够使用 google 驱动器 API 获得传播 sheet ID。但是,修改页面的尺寸需要 sheet ID。
我找不到通过驱动器 API(文件属性)检索此 sheet ID 的方法,也找不到任何关于如何列出可用 sheets 在价差内sheet 鉴于我有价差sheet Id.
我尝试使用 google 应用程序脚本来实现我的目标,但是 运行 时间已经超过了允许的限制(5 分钟),即使在用尽了所有优化代码的可能性之后。
可以空着spreadsheets.get() to get all the sheets id available in your spreadsheet. You just need to provide the spreadsheet id
in your path parameters, you can leave the query parameters使用。
它将return一个Spreadsheet Resource which contains sheets information under sheets
-> properties
field. See Sheets Object Resource
示例电子表格:
使用 API 资源管理器的示例请求:
响应示例:
{
"spreadsheetId": "1RPQ7WOTOZZSirf60kP6nULhViCdsuGHcOVoUxxxx",
"properties": {
"title": "NewSheet",
......
},
......
"sheets": [
{
"properties": {
"sheetId": 0,
"title": "Sheet1",
"index": 0,
"sheetType": "GRID",
"gridProperties": {
"rowCount": 1000,
"columnCount": 26
}
}
},
{
"properties": {
"sheetId": 500406870,
"title": "Sheet2",
"index": 1,
"sheetType": "GRID",
"gridProperties": {
"rowCount": 1000,
"columnCount": 26
}
}
}
],
}