Skip to main content

A sphinx extension for making table from Excel file

Project description

A sphinx extension for making table from Excel file.

  • Depends on OpenPyXL

    • Supports xlsx file

  • Supports merged cell

  • Supports Japanese

This extension generates a grid table string internally from Excel file.

Install and Set up

Install from PyPI.

$ pip install sphinxcontrib-xlsxtable

Configure conf.py

# conf.py
extensions = [
    'sphinxcontrib.xlsxtable',
]

Usage

reStructuredText directive:

.. xlsx-table:: Table Caption
   :file: path/to/xlsx/file.xlsx
   :header-rows: 1

Excel file:

https://raw.githubusercontent.com/kkAyataka/sphinxcontrib-xlsxtable/master/sample-excel.png

Rendered HTML:

https://raw.githubusercontent.com/kkAyataka/sphinxcontrib-xlsxtable/master/sample-rendering.png

Options

Caption (optional)

Specifies table caption string.

.. xlsx-table:: Table Caption
   :file: path/to/xlsx/file.xlsx

:file: (required)

Specifies path to Excel file. You can use relative path.

.. xlsx-table::
   :file: path/to/xlsx/file.xlsx

:header-rows: (optional)

Specified the number of lines are used as header.

.. xlsx-table::
   :file: path/to/xlsx/file.xlsx
   :header-rows: 1

:sheet: (optional)

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

:start-row: (optional)

Specifies start row.

.. xlsx-table::
   :file: path/to/xlsx/file.xlsx
   :start-row: 2

CLI

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 |
+----+-------+-------+--------+

LICENSE

  • MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinxcontrib-xlsxtable-0.1.10.dev20200411.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file sphinxcontrib-xlsxtable-0.1.10.dev20200411.tar.gz.

File metadata

  • Download URL: sphinxcontrib-xlsxtable-0.1.10.dev20200411.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.4

File hashes

Hashes for sphinxcontrib-xlsxtable-0.1.10.dev20200411.tar.gz
Algorithm Hash digest
SHA256 aac1251516b2516aec19d319ff0a3c4cebb1c05749745191b8789519abe8f670
MD5 5433ff3c6d5ab175bd1e028d96675c3c
BLAKE2b-256 4bbdfc8db74c1bb0db688f3f80999798d9860c207cc5a951f9179a1bd37c1de4

See more details on using hashes here.

File details

Details for the file sphinxcontrib_xlsxtable-0.1.10.dev20200411-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinxcontrib_xlsxtable-0.1.10.dev20200411-py3-none-any.whl
Algorithm Hash digest
SHA256 68db77a06449f659e3fa6b8301880eb8231a19845af96ef790dc5a22ca320b96
MD5 4009500ab190cc2e00ce92f27f2fec55
BLAKE2b-256 af5bf8367ec1ab105430be9328d829c93964a0b86f8d9d869849f1f3bccb2cfc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page