# REST API
*版本0.13.0中的新功能。*
## 快速开始
xlwings提供了一种在Windows和macOS上通过REST API公开Excel工作簿的简便方法。 当您在单台计算机上运行工作簿并希望从另一台计算机访问它时,这可能很有用。 或者,您可以构建一个基于Linux的Web应用程序,可以在将Excel功能迁移到Web应用程序的过程中与旧版Excel应用程序进行交互(如果您需要帮助,请[吆喝一声](https://www.zoomeranalytics.com/contact))。
您可以从命令提示符或终端运行REST API服务器,如下所示(这需要Flask> = 1.0,因此请确保`pip install Flask`):
~~~
xlwings restapi run
~~~
然后执行GET请求,例如 通过Windows上的PowerShell或Mac上的终端(同时打开未保存的“Book1”)。 请注意,您需要从两个单独的终端运行服务器和GET请求(或者您可以使用更方便的东西,如[Postman](https://www.getpostman.com/)或[Insomnia](https://insomnia.rest/)用于测试API):
~~~
$ curl "http://127.0.0.1:5000/book/book1/sheets/0/range/A1:B2"
{
"address": "$A$1:$B$2",
"color": null,
"column": 1,
"column_width": 10.0,
"count": 4,
"current_region": "$A$1:$B$2",
"formula": [
[
"1",
"2"
],
[
"3",
"4"
]
],
"formula_array": null,
"height": 32.0,
"last_cell": "$B$2",
"left": 0.0,
"name": null,
"number_format": "General",
"row": 1,
"row_height": 16.0,
"shape": [
2,
2
],
"size": 4,
"top": 0.0,
"value": [
[
1.0,
2.0
],
[
3.0,
4.0
]
],
"width": 130.0
}
~~~
在服务器运行的命令提示符下,按`Ctrl-C`再次将其关闭。
XLwings REST API是围绕[python api](api.md)的一个薄包装,如果您以前使用过XLwings,它将非常容易。它还意味着REST API需要Excel应用程序启动和运行,如果Excel工作簿中的数据不断变化,这是一个很好的选择,因为REST API总是传递工作簿的当前状态,而不需要先保存它。
>[info]注意
目前,我们只提供GET方法来读取工作簿。 如果您对编辑工作簿的POST方法感兴趣,请通过GitHub问题告诉我们。 其他一些事情也需要改进,最值得注意的是异常处理。
## 运行服务器
`xlwings restapi run`将在[http://127.0.0.1:5000 ](http://127.0.0.1:5000)上运行Flask开发服务器。 你可以提供`--host`和`--port`作为命令行参数,它也尊重Flask环境变量,如`FLASK_ENV = development`。
如果您想获得更多控制权,可以直接使用Flask运行服务器,有关详细信息,请参阅[Flask docs](http://flask.pocoo.org/docs/1.0/quickstart/):
~~~
set FLASK_APP=xlwings.rest.api
flask run
~~~
如果您使用的是Mac,请使用`export FLASK_APP = xlwings.rest.api`而不是`set FLASK_APP = xlwings.rest.api`。
对于生产,您可以使用任何WSGI HTTP服务器,如[gunicorn](https://gunicorn.org)(在Mac上)或[waitress](https://docs.pylonsproject.org/projects/waitress/en/latest/)(在Mac/windows上)来服务API。例如,使用gunicorn,您可以执行以下操作:`gunicorn xlwings.rest.api:api`。或者使用waitress(如果要使API从本地主机外部可访问,请相应地调整主机):
~~~
from xlwings.rest.api import api
from waitress import serve
serve(wsgiapp, host='127.0.0.1', port=5000)
~~~
## 索引
虽然Python API提供Python的基于0的索引(例如`xw.books [0]`)以及Excel的基于1的索引(例如`xw.books(1)`),但REST API仅提供基于0的索引 ,例如`/book/0`。
## Range选项
REST API接受Range选项作为查询参数,参见[`xlwings.Range.options()`](api.md),例如
`/book/book1/sheets/0/range/A1?expand=table&transpose=true`
请记住,`options`只会影响`value`属性。
## 端点概述
| 端点 | 对应于 | 简短描述 |
| --- | --- | --- |
| [/book](#book) | [Book](api.md) | 在所有打开的Excel实例中查找工作簿,如果找不到该工作簿,则将其打开 |
| [/books](#books) | [Books](api.md) | 活动Excel实例的工作簿集合 |
| [/apps](#apps) | [Apps](api.md) | 这允许您指定要使用的Excel实例 |
## 端点详情
### /book
`GET` `/book/<fullname_or_name>`
**Example response**:
~~~
{
"app": 1104,
"fullname": "C:\\Users\\felix\\DEV\\xlwings\\scripts\\Book1.xlsx",
"name": "Book1.xlsx",
"names": [
"Sheet1!myname1",
"myname2"
],
"selection": "Sheet2!$A$1",
"sheets": [
"Sheet1",
"Sheet2"
]
}
~~~
`GET` `/book/<fullname_or_name>/names`
**Example response**:
~~~
{
"names": [
{
"name": "Sheet1!myname1",
"refers_to": "=Sheet1!$B$2:$C$3"
},
{
"name": "myname2",
"refers_to": "=Sheet1!$A$1"
}
]
}
~~~
`GET` `/book/<fullname_or_name>/names/<name>`
**Example response**:
~~~
{
"name": "myname2",
"refers_to": "=Sheet1!$A$1"
}
~~~
`GET` `/book/<fullname_or_name>/names/<name>/range`
**Example response**:
~~~
{
"address": "$A$1",
"color": null,
"column": 1,
"column_width": 8.47,
"count": 1,
"current_region": "$A$1:$B$2",
"formula": "=1+1.1",
"formula_array": "=1+1,1",
"height": 14.25,
"last_cell": "$A$1",
"left": 0.0,
"name": "myname2",
"number_format": "General",
"row": 1,
"row_height": 14.3,
"shape": [
1,
1
],
"size": 1,
"top": 0.0,
"value": 2.1,
"width": 51.0
}
~~~
`GET` `/book/<fullname_or_name>/sheets`
**Example response**:
~~~
{
"sheets": [
{
"charts": [
"Chart 1"
],
"name": "Sheet1",
"names": [
"Sheet1!myname1"
],
"pictures": [
"Picture 3"
],
"shapes": [
"Chart 1",
"Picture 3"
],
"used_range": "$A$1:$B$2"
},
{
"charts": [],
"name": "Sheet2",
"names": [],
"pictures": [],
"shapes": [],
"used_range": "$A$1"
}
]
}
~~~
`GET` `/book/<fullname_or_name>/sheets/<sheet_name_or_ix>`
**Example response**:
~~~
{
"charts": [
"Chart 1"
],
"name": "Sheet1",
"names": [
"Sheet1!myname1"
],
"pictures": [
"Picture 3"
],
"shapes": [
"Chart 1",
"Picture 3"
],
"used_range": "$A$1:$B$2"
}
~~~
`GET` `/book/<fullname_or_name>/sheets/<sheet_name_or_ix>/charts`
**Example response**:
~~~
{
"charts": [
{
"chart_type": "line",
"height": 211.0,
"left": 0.0,
"name": "Chart 1",
"top": 0.0,
"width": 355.0
}
]
}
~~~
`GET` `/book/<fullname_or_name>/sheets/<sheet_name_or_ix>/charts/<chart_name_or_ix>`
**Example response**:
~~~
{
"chart_type": "line",
"height": 211.0,
"left": 0.0,
"name": "Chart 1",
"top": 0.0,
"width": 355.0
}
~~~
`GET` `/book/<fullname_or_name>/sheets/<sheet_name_or_ix>/names`
**Example response**:
~~~
{
"names": [
{
"name": "Sheet1!myname1",
"refers_to": "=Sheet1!$B$2:$C$3"
}
]
}
~~~
`GET` `/book/<fullname_or_name>/sheets/<sheet_name_or_ix>/names/<sheet_scope_name>`
**Example response**:
~~~
{
"name": "Sheet1!myname1",
"refers_to": "=Sheet1!$B$2:$C$3"
}
~~~
`GET` `/book/<fullname_or_name>/sheets/<sheet_name_or_ix>/names/<sheet_scope_name>/range`
**Example response**:
~~~
{
"address": "$B$2:$C$3",
"color": null,
"column": 2,
"column_width": 8.47,
"count": 4,
"current_region": "$A$1:$B$2",
"formula": [
[
"",
""
],
[
"",
""
]
],
"formula_array": "",
"height": 28.5,
"last_cell": "$C$3",
"left": 51.0,
"name": "Sheet1!myname1",
"number_format": "General",
"row": 2,
"row_height": 14.3,
"shape": [
2,
2
],
"size": 4,
"top": 14.25,
"value": [
[
null,
null
],
[
null,
null
]
],
"width": 102.0
}
~~~
`GET` `/book/<fullname_or_name>/sheets/<sheet_name_or_ix>/pictures`
**Example response**:
~~~
{
"pictures": [
{
"height": 100.0,
"left": 0.0,
"name": "Picture 3",
"top": 0.0,
"width": 100.0
}
]
}
~~~
`GET` `/book/<fullname_or_name>/sheets/<sheet_name_or_ix>/pictures/<picture_name_or_ix>`
**Example response**:
~~~
{
"height": 100.0,
"left": 0.0,
"name": "Picture 3",
"top": 0.0,
"width": 100.0
}
~~~
`GET` `/book/<fullname_or_name>/sheets/<sheet_name_or_ix>/range`
**Example response**:
~~~
{
"address": "$A$1:$B$2",
"color": null,
"column": 1,
"column_width": 8.47,
"count": 4,
"current_region": "$A$1:$B$2",
"formula": [
[
"=1+1.1",
"a string"
],
[
"43395.0064583333",
""
]
],
"formula_array": null,
"height": 28.5,
"last_cell": "$B$2",
"left": 0.0,
"name": null,
"number_format": null,
"row": 1,
"row_height": 14.3,
"shape": [
2,
2
],
"size": 4,
"top": 0.0,
"value": [
[
2.1,
"a string"
],
[
"Mon, 22 Oct 2018 00:09:18 GMT",
null
]
],
"width": 102.0
}
~~~
`GET` `/book/<fullname_or_name>/sheets/<sheet_name_or_ix>/range/<address>`
**Example response**:
~~~
{
"address": "$A$1:$B$2",
"color": null,
"column": 1,
"column_width": 8.47,
"count": 4,
"current_region": "$A$1:$B$2",
"formula": [
[
"=1+1.1",
"a string"
],
[
"43395.0064583333",
""
]
],
"formula_array": null,
"height": 28.5,
"last_cell": "$B$2",
"left": 0.0,
"name": null,
"number_format": null,
"row": 1,
"row_height": 14.3,
"shape": [
2,
2
],
"size": 4,
"top": 0.0,
"value": [
[
2.1,
"a string"
],
[
"Mon, 22 Oct 2018 00:09:18 GMT",
null
]
],
"width": 102.0
}
~~~
`GET` `/book/<fullname_or_name>/sheets/<sheet_name_or_ix>/shapes`
**Example response**:
~~~
{
"shapes": [
{
"height": 211.0,
"left": 0.0,
"name": "Chart 1",
"top": 0.0,
"type": "chart",
"width": 355.0
},
{
"height": 100.0,
"left": 0.0,
"name": "Picture 3",
"top": 0.0,
"type": "picture",
"width": 100.0
}
]
}
~~~
`GET` `/book/<fullname_or_name>/sheets/<sheet_name_or_ix>/shapes/<shape_name_or_ix>`
**Example response**:
~~~
{
"height": 211.0,
"left": 0.0,
"name": "Chart 1",
"top": 0.0,
"type": "chart",
"width": 355.0
}
~~~
### /books
`GET` `/books`
**Example response**:
~~~
{
"books": [
{
"app": 1104,
"fullname": "Book1",
"name": "Book1",
"names": [],
"selection": "Sheet2!$A$1",
"sheets": [
"Sheet1"
]
},
{
"app": 1104,
"fullname": "C:\\Users\\felix\\DEV\\xlwings\\scripts\\Book1.xlsx",
"name": "Book1.xlsx",
"names": [
"Sheet1!myname1",
"myname2"
],
"selection": "Sheet2!$A$1",
"sheets": [
"Sheet1",
"Sheet2"
]
},
{
"app": 1104,
"fullname": "Book4",
"name": "Book4",
"names": [],
"selection": "Sheet2!$A$1",
"sheets": [
"Sheet1"
]
}
]
}
~~~
`GET` `/books/<book_name_or_ix>`
**Example response**:
~~~
{
"app": 1104,
"fullname": "C:\\Users\\felix\\DEV\\xlwings\\scripts\\Book1.xlsx",
"name": "Book1.xlsx",
"names": [
"Sheet1!myname1",
"myname2"
],
"selection": "Sheet2!$A$1",
"sheets": [
"Sheet1",
"Sheet2"
]
}
~~~
`GET` `/books/<book_name_or_ix>/names`
**Example response**:
~~~
{
"names": [
{
"name": "Sheet1!myname1",
"refers_to": "=Sheet1!$B$2:$C$3"
},
{
"name": "myname2",
"refers_to": "=Sheet1!$A$1"
}
]
}
~~~
`GET` `/books/<book_name_or_ix>/names/<name>`
**Example response**:
~~~
{
"name": "myname2",
"refers_to": "=Sheet1!$A$1"
}
~~~
`GET` `/books/<book_name_or_ix>/names/<name>/range`
**Example response**:
~~~
{
"address": "$A$1",
"color": null,
"column": 1,
"column_width": 8.47,
"count": 1,
"current_region": "$A$1:$B$2",
"formula": "=1+1.1",
"formula_array": "=1+1,1",
"height": 14.25,
"last_cell": "$A$1",
"left": 0.0,
"name": "myname2",
"number_format": "General",
"row": 1,
"row_height": 14.3,
"shape": [
1,
1
],
"size": 1,
"top": 0.0,
"value": 2.1,
"width": 51.0
}
~~~
`GET` `/books/<book_name_or_ix>/sheets`
**Example response**:
~~~
{
"sheets": [
{
"charts": [
"Chart 1"
],
"name": "Sheet1",
"names": [
"Sheet1!myname1"
],
"pictures": [
"Picture 3"
],
"shapes": [
"Chart 1",
"Picture 3"
],
"used_range": "$A$1:$B$2"
},
{
"charts": [],
"name": "Sheet2",
"names": [],
"pictures": [],
"shapes": [],
"used_range": "$A$1"
}
]
}
~~~
`GET` `/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>`
**Example response**:
~~~
{
"charts": [
"Chart 1"
],
"name": "Sheet1",
"names": [
"Sheet1!myname1"
],
"pictures": [
"Picture 3"
],
"shapes": [
"Chart 1",
"Picture 3"
],
"used_range": "$A$1:$B$2"
}
~~~
`GET` `/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/charts`
**Example response**:
~~~
{
"charts": [
{
"chart_type": "line",
"height": 211.0,
"left": 0.0,
"name": "Chart 1",
"top": 0.0,
"width": 355.0
}
]
}
~~~
`GET` `/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/charts/<chart_name_or_ix>`
**Example response**:
~~~
{
"chart_type": "line",
"height": 211.0,
"left": 0.0,
"name": "Chart 1",
"top": 0.0,
"width": 355.0
}
~~~
`GET` `/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/names`
**Example response**:
~~~
{
"names": [
{
"name": "Sheet1!myname1",
"refers_to": "=Sheet1!$B$2:$C$3"
}
]
}
~~~
`GET` `/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/names/<sheet_scope_name>`
**Example response**:
~~~
{
"name": "Sheet1!myname1",
"refers_to": "=Sheet1!$B$2:$C$3"
}
~~~
`GET` `/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/names/<sheet_scope_name>/range`
**Example response**:
~~~
{
"address": "$B$2:$C$3",
"color": null,
"column": 2,
"column_width": 8.47,
"count": 4,
"current_region": "$A$1:$B$2",
"formula": [
[
"",
""
],
[
"",
""
]
],
"formula_array": "",
"height": 28.5,
"last_cell": "$C$3",
"left": 51.0,
"name": "Sheet1!myname1",
"number_format": "General",
"row": 2,
"row_height": 14.3,
"shape": [
2,
2
],
"size": 4,
"top": 14.25,
"value": [
[
null,
null
],
[
null,
null
]
],
"width": 102.0
}
~~~
`GET` `/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/pictures`
**Example response**:
~~~
{
"pictures": [
{
"height": 100.0,
"left": 0.0,
"name": "Picture 3",
"top": 0.0,
"width": 100.0
}
]
}
~~~
`GET` `/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/pictures/<picture_name_or_ix>`
**Example response**:
~~~
{
"height": 100.0,
"left": 0.0,
"name": "Picture 3",
"top": 0.0,
"width": 100.0
}
~~~
`GET` `/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/range`
**Example response**:
~~~
{
"address": "$A$1:$B$2",
"color": null,
"column": 1,
"column_width": 8.47,
"count": 4,
"current_region": "$A$1:$B$2",
"formula": [
[
"=1+1.1",
"a string"
],
[
"43395.0064583333",
""
]
],
"formula_array": null,
"height": 28.5,
"last_cell": "$B$2",
"left": 0.0,
"name": null,
"number_format": null,
"row": 1,
"row_height": 14.3,
"shape": [
2,
2
],
"size": 4,
"top": 0.0,
"value": [
[
2.1,
"a string"
],
[
"Mon, 22 Oct 2018 00:09:18 GMT",
null
]
],
"width": 102.0
}
~~~
`GET` `/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/range/<address>`
**Example response**:
~~~
{
"address": "$A$1:$B$2",
"color": null,
"column": 1,
"column_width": 8.47,
"count": 4,
"current_region": "$A$1:$B$2",
"formula": [
[
"=1+1.1",
"a string"
],
[
"43395.0064583333",
""
]
],
"formula_array": null,
"height": 28.5,
"last_cell": "$B$2",
"left": 0.0,
"name": null,
"number_format": null,
"row": 1,
"row_height": 14.3,
"shape": [
2,
2
],
"size": 4,
"top": 0.0,
"value": [
[
2.1,
"a string"
],
[
"Mon, 22 Oct 2018 00:09:18 GMT",
null
]
],
"width": 102.0
}
~~~
`GET` `/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/shapes`
**Example response**:
~~~
{
"shapes": [
{
"height": 211.0,
"left": 0.0,
"name": "Chart 1",
"top": 0.0,
"type": "chart",
"width": 355.0
},
{
"height": 100.0,
"left": 0.0,
"name": "Picture 3",
"top": 0.0,
"type": "picture",
"width": 100.0
}
]
}
~~~
`GET` `/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/shapes/<shape_name_or_ix>`
**Example response**:
~~~
{
"height": 211.0,
"left": 0.0,
"name": "Chart 1",
"top": 0.0,
"type": "chart",
"width": 355.0
}
~~~
### /apps
`GET` `/apps`
**Example response**:
~~~
{
"apps": [
{
"books": [
"Book1",
"C:\\Users\\felix\\DEV\\xlwings\\scripts\\Book1.xlsx",
"Book4"
],
"calculation": "automatic",
"display_alerts": true,
"pid": 1104,
"screen_updating": true,
"selection": "[Book1.xlsx]Sheet2!$A$1",
"version": "16.0",
"visible": true
},
{
"books": [
"Book2",
"Book5"
],
"calculation": "automatic",
"display_alerts": true,
"pid": 7920,
"screen_updating": true,
"selection": "[Book5]Sheet2!$A$1",
"version": "16.0",
"visible": true
}
]
}
~~~
`GET` `/apps/<pid>`
**Example response**:
~~~
{
"books": [
"Book1",
"C:\\Users\\felix\\DEV\\xlwings\\scripts\\Book1.xlsx",
"Book4"
],
"calculation": "automatic",
"display_alerts": true,
"pid": 1104,
"screen_updating": true,
"selection": "[Book1.xlsx]Sheet2!$A$1",
"version": "16.0",
"visible": true
}
~~~
`GET` `/apps/<pid>/books`
**Example response**:
~~~
{
"books": [
{
"app": 1104,
"fullname": "Book1",
"name": "Book1",
"names": [],
"selection": "Sheet2!$A$1",
"sheets": [
"Sheet1"
]
},
{
"app": 1104,
"fullname": "C:\\Users\\felix\\DEV\\xlwings\\scripts\\Book1.xlsx",
"name": "Book1.xlsx",
"names": [
"Sheet1!myname1",
"myname2"
],
"selection": "Sheet2!$A$1",
"sheets": [
"Sheet1",
"Sheet2"
]
},
{
"app": 1104,
"fullname": "Book4",
"name": "Book4",
"names": [],
"selection": "Sheet2!$A$1",
"sheets": [
"Sheet1"
]
}
]
}
~~~
`GET` `/apps/<pid>/books/<book_name_or_ix>`
**Example response**:
~~~
{
"app": 1104,
"fullname": "C:\\Users\\felix\\DEV\\xlwings\\scripts\\Book1.xlsx",
"name": "Book1.xlsx",
"names": [
"Sheet1!myname1",
"myname2"
],
"selection": "Sheet2!$A$1",
"sheets": [
"Sheet1",
"Sheet2"
]
}
~~~
`GET` `/apps/<pid>/books/<book_name_or_ix>/names`
**Example response**:
~~~
{
"names": [
{
"name": "Sheet1!myname1",
"refers_to": "=Sheet1!$B$2:$C$3"
},
{
"name": "myname2",
"refers_to": "=Sheet1!$A$1"
}
]
}
~~~
`GET` `/apps/<pid>/books/<book_name_or_ix>/names/<name>`
**Example response**:
~~~
{
"name": "myname2",
"refers_to": "=Sheet1!$A$1"
}
~~~
`GET` `/apps/<pid>/books/<book_name_or_ix>/names/<name>/range`
**Example response**:
~~~
{
"address": "$A$1",
"color": null,
"column": 1,
"column_width": 8.47,
"count": 1,
"current_region": "$A$1:$B$2",
"formula": "=1+1.1",
"formula_array": "=1+1,1",
"height": 14.25,
"last_cell": "$A$1",
"left": 0.0,
"name": "myname2",
"number_format": "General",
"row": 1,
"row_height": 14.3,
"shape": [
1,
1
],
"size": 1,
"top": 0.0,
"value": 2.1,
"width": 51.0
}
~~~
`GET` `/apps/<pid>/books/<book_name_or_ix>/sheets`
**Example response**:
~~~
{
"sheets": [
{
"charts": [
"Chart 1"
],
"name": "Sheet1",
"names": [
"Sheet1!myname1"
],
"pictures": [
"Picture 3"
],
"shapes": [
"Chart 1",
"Picture 3"
],
"used_range": "$A$1:$B$2"
},
{
"charts": [],
"name": "Sheet2",
"names": [],
"pictures": [],
"shapes": [],
"used_range": "$A$1"
}
]
}
~~~
`GET` `/apps/<pid>/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>`
**Example response**:
~~~
{
"charts": [
"Chart 1"
],
"name": "Sheet1",
"names": [
"Sheet1!myname1"
],
"pictures": [
"Picture 3"
],
"shapes": [
"Chart 1",
"Picture 3"
],
"used_range": "$A$1:$B$2"
}
~~~
`GET` `/apps/<pid>/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/charts`
**Example response**:
~~~
{
"charts": [
{
"chart_type": "line",
"height": 211.0,
"left": 0.0,
"name": "Chart 1",
"top": 0.0,
"width": 355.0
}
]
}
~~~
`GET` `/apps/<pid>/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/charts/<chart_name_or_ix>`
**Example response**:
~~~
{
"chart_type": "line",
"height": 211.0,
"left": 0.0,
"name": "Chart 1",
"top": 0.0,
"width": 355.0
}
~~~
`GET` `/apps/<pid>/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/names`
**Example response**:
~~~
{
"names": [
{
"name": "Sheet1!myname1",
"refers_to": "=Sheet1!$B$2:$C$3"
}
]
}
~~~
`GET` `/apps/<pid>/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/names/<sheet_scope_name>`
**Example response**:
~~~
{
"name": "Sheet1!myname1",
"refers_to": "=Sheet1!$B$2:$C$3"
}
~~~
`GET` `/apps/<pid>/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/names/<sheet_scope_name>/range`
**Example response**:
~~~
{
"address": "$B$2:$C$3",
"color": null,
"column": 2,
"column_width": 8.47,
"count": 4,
"current_region": "$A$1:$B$2",
"formula": [
[
"",
""
],
[
"",
""
]
],
"formula_array": "",
"height": 28.5,
"last_cell": "$C$3",
"left": 51.0,
"name": "Sheet1!myname1",
"number_format": "General",
"row": 2,
"row_height": 14.3,
"shape": [
2,
2
],
"size": 4,
"top": 14.25,
"value": [
[
null,
null
],
[
null,
null
]
],
"width": 102.0
}
~~~
`GET` `/apps/<pid>/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/pictures`
**Example response**:
~~~
{
"pictures": [
{
"height": 100.0,
"left": 0.0,
"name": "Picture 3",
"top": 0.0,
"width": 100.0
}
]
}
~~~
`GET` `/apps/<pid>/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/pictures/<picture_name_or_ix>`
**Example response**:
~~~
{
"height": 100.0,
"left": 0.0,
"name": "Picture 3",
"top": 0.0,
"width": 100.0
}
~~~
`GET` `/apps/<pid>/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/range`
**Example response**:
~~~
{
"address": "$A$1:$B$2",
"color": null,
"column": 1,
"column_width": 8.47,
"count": 4,
"current_region": "$A$1:$B$2",
"formula": [
[
"=1+1.1",
"a string"
],
[
"43395.0064583333",
""
]
],
"formula_array": null,
"height": 28.5,
"last_cell": "$B$2",
"left": 0.0,
"name": null,
"number_format": null,
"row": 1,
"row_height": 14.3,
"shape": [
2,
2
],
"size": 4,
"top": 0.0,
"value": [
[
2.1,
"a string"
],
[
"Mon, 22 Oct 2018 00:09:18 GMT",
null
]
],
"width": 102.0
}
~~~
`GET` `/apps/<pid>/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/range/<address>`
**Example response**:
~~~
{
"address": "$A$1:$B$2",
"color": null,
"column": 1,
"column_width": 8.47,
"count": 4,
"current_region": "$A$1:$B$2",
"formula": [
[
"=1+1.1",
"a string"
],
[
"43395.0064583333",
""
]
],
"formula_array": null,
"height": 28.5,
"last_cell": "$B$2",
"left": 0.0,
"name": null,
"number_format": null,
"row": 1,
"row_height": 14.3,
"shape": [
2,
2
],
"size": 4,
"top": 0.0,
"value": [
[
2.1,
"a string"
],
[
"Mon, 22 Oct 2018 00:09:18 GMT",
null
]
],
"width": 102.0
}
~~~
`GET` `/apps/<pid>/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/shapes`
**Example response**:
~~~
{
"shapes": [
{
"height": 211.0,
"left": 0.0,
"name": "Chart 1",
"top": 0.0,
"type": "chart",
"width": 355.0
},
{
"height": 100.0,
"left": 0.0,
"name": "Picture 3",
"top": 0.0,
"type": "picture",
"width": 100.0
}
]
}
~~~
`GET` `/apps/<pid>/books/<book_name_or_ix>/sheets/<sheet_name_or_ix>/shapes/<shape_name_or_ix>`
**Example response**:
~~~
{
"height": 211.0,
"left": 0.0,
"name": "Chart 1",
"top": 0.0,
"type": "chart",
"width": 355.0
}
~~~