A sphinx extension for making table from Excel file.
- Depends on OpenPyXL
- Supports xlsx file
- Supports merged cell
- Supports images
- Supports Japanese
This extension generates a grid table string internally from Excel file.
Install from PyPI.
$ pip install sphinxcontrib-xlsxtable
Configure conf.py
# conf.py
extensions = [
'sphinxcontrib.xlsxtable',
]
reStructuredText directive:
.. xlsx-table:: Table Caption
:file: path/to/xlsx/file.xlsx
:header-rows: 1
Excel file:
Rendered HTML:
Specifies table caption string.
.. xlsx-table:: Table Caption
:file: path/to/xlsx/file.xlsx
Specifies path to Excel file. You can use relative path.
.. xlsx-table::
:file: path/to/xlsx/file.xlsx
Specified the number of lines are used as header.
.. xlsx-table::
:file: path/to/xlsx/file.xlsx
:header-rows: 1
Generates a table from a sheet with the specified sheet name.
If this option is not specified, current active sheet is used.
.. xlsx-table::
:file: path/to/xlsx/file.xlsx
:sheet: Sheet1
Specifies start row number.
.. xlsx-table::
:file: path/to/xlsx/file.xlsx
:start-row: 2
Specifies start column number.
.. xlsx-table::
:file: path/to/xlsx/file.xlsx
:start-column: 2
Specifies include or exclude rows. Exclude setting has priority.
.. xlsx-table::
:file: path/to/xlsx/file.xlsx
:include-rows: 1-2 4 8
:exclude-rows: 3 5-7
Specifies include or exclude columns. Exclude setting has priority.
.. xlsx-table::
:file: path/to/xlsx/file.xlsx
:include-columns: A-B 4
:exclude-columns: C 5-6
You can use from CLI.
$ python -m sphinxcontrib.xlsxtable --sheet=Sheet1 --header-rows=1 test/_res/sample.xlsx +----+-------+-------+--------+ | A1 | B1 | C1 | D1 | +====+=======+=======+========+ | A2 | B2:B3 | C2 | D2 | +----+ +-------+--------+ | A3 | | C3:D3 | +----+-------+-------+--------+ | A4 | B4 | C4 | - D4-1 | | | | | - D4-2 | +----+-------+-------+--------+
- sphinxcontrib-xlsxtableの解説
- sphinxcontrib-xlsxtableのモジュール実行
- sphinxcontrib-xlsxtableに行・列指定オプションを追加
- sphinxcontrib-xlsxtableの画像対応
- MIT