Skip to main content

an extension for sphinx to display excel table in sphinx documents

Project description

sphinx-excel

sphinx-excel Documentation Status pytest mypy flake8 pytest

introduction

sphinx-excel uses openpyxl to read an excel file and render it into sphinx document.

installation

you can install sphinx-excel by pip.

python3 -m pip install sphinx-excel

setup

please add sphinxcontrib.excel into your conf.py file.

extensions = [
    'sphinxcontrib.excel',
]

usage

the following code will insert the first sheet of tables.xlsx into sphinx document.

.. excel:: ./tables.xlsx

the excel directive will show the sheet name as the caption of table. you can use :no-caption to remove it.

.. excel:: ./tables.xlsx
   :no-caption:

if you want to specify the caption, you can use :caption: argument.

.. excel:: ./tables.xlsx
   :caption: hello world

excel directive supports all arguments of sphinx native table directive. for example, you can use :align: to change table align style.

.. excel:: ./tables.xlsx
   :align: center

if an excel file contains more than one sheets, you can use :sheet: arguments to specify which sheet to be rendered.

.. excel:: ./tables.xlsx
   :align: center
   :sheet: stuff

the first line of table is in bold font, it means that the first line is header of table. if the table has two rows header, you can use :headers: to tell excel directive.

.. excel:: ./tables.xlsx
   :headers: 2

one more thing

excel directive supports to render merged cell in excel. the content of the cell can be:

  • math equtions,
  • code snippets, and
  • other directives.

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

sphinx-excel-1.0.1.tar.gz (5.7 kB view hashes)

Uploaded Source

Built Distribution

sphinx_excel-1.0.1-py3-none-any.whl (7.6 kB view hashes)

Uploaded Python 3

Supported by

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