# 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
}
~~~