Skip to main content

Bring the power of Handsontable to Python and Jupyter Notebook

Project description


Build Status PyPI version PyPI license PyPI pyversions

View a 2-D array, probably from pyexcel in Jupyter Notebook, and export to *.html.


pip install pyhandsontable


>>> from pyhandsontable import view_table
>>> view_table(width=800, height=500, data=data_matrix, **kwargs)
A Handsontable is shown in Jupyter Notebook.

Acceptable kwargs

  • title: title of the HTML file
  • maxColWidth: maximum column width. (Default: 200)
  • rowHeaders: rowHeaders you want to display (Default: True)
  • colHeaders: colHeaders you want to display (Default: True)
  • renderers: custom renderers you want to use for each column, e.g. HTML. If not defined, it will be autogenerated. For more information, please see
  • autodelete: whether the temporary HTML file should be autodeleted. (Default: True)
  • filename: filename of the temporary HTML file (default: 'temp.handsontable.html')
  • css: url of the Handsontable CSS
  • js: url of the Handsontable Javascript
  • config: add additional config as defined in
    • This will override the default config (per key basis) which are:
  data: data,
  rowHeaders: rowHeaders,
  colHeaders: colHeaders,
  dropdownMenu: true,
  filters: true,
  columns: autogenerated from renderers,
  modifyColWidth: function(width, col){
    if(width > maxColWidth) return maxColWidth;

Example renderers:

    'front': 'html',
    'back': 'html'

Post-creation editing of the HTML

You might try from bs4 import BeautifulSoup:

        config = {
            'colHeaders': ['id'] + list(CardTuple._fields),
            'columns': [
                {'data': 0},
                {'data': 1, 'renderer': 'markdownRenderer'},
                {'data': 2, 'renderer': 'markdownRenderer'},
                {'data': 3},
                {'data': 4}
        filename = 'temp.handsontable.html'
            table = view_table(data=([[i] + list(record.to_formatted_tuple())
                                 for i, record in self.find(keyword_regex, tags)]),
            with open(filename, 'r') as f:
                soup = BeautifulSoup(, 'html.parser')

            div = soup.new_tag('div')

            js_markdown = soup.new_tag('script',
            js_custom = soup.new_tag('script')

            with open('gflashcards/js/markdown-hot.js') as f:


            script_tag = soup.find('script')
            soup.body.insert(soup.body.contents.index(script_tag) + 1, div)

            with open(filename, 'w') as f:

            return table
            Timer(5, os.unlink, args=[filename]).start()



Related projects

Project details

Download files

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

Files for pyhandsontable, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size pyhandsontable-0.2.0-py3-none-any.whl (7.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pyhandsontable-0.2.0.tar.gz (4.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page