# Best tool for printing tables in Jupyter notebook?

**URL:** <https://discourse.julialang.org/t/best-tool-for-printing-tables-in-jupyter-notebook/3548>\
**Category:** General Usage\
**Tags:** question\
**Created:** [May 6, 2017, 12:10am UTC](https://discourse.julialang.org/t/best-tool-for-printing-tables-in-jupyter-notebook/3548 "2017-05-06T00:10:22Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![djsegal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/djsegal/32/13752_2.png) [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Post date:** [May 7, 2017, 8:23pm UTC](https://discourse.julialang.org/t/best-tool-for-printing-tables-in-jupyter-notebook/3548/8 "2017-05-07T20:23:06Z")

</div>

I wrote this up. It’s basically just @cstjean’s code from above:

There’s probably more to be done on it

```julia
module HTMLElements

  export table

  function table(cur_matrix::Matrix; header_row=[], title=nothing)

    cur_table = ""

    if title != nothing
      cur_table *= "<h2 style='padding: 10px'>$title</h2>"
    end

    cur_table *= "<table class='table table-striped'>"

    if !isempty(header_row)
      cur_table *= "<thead><tr>"

      for cur_header in header_row
        cur_table *= "<th>$cur_header</th>"
      end

      cur_table *= "</tr></thead>"
    end

    cur_table *= "<tbody>"

    for ii in 1:size(cur_matrix, 1)

      cur_table *= "<tr>"

      for jj in 1:size(cur_matrix, 2)
        cur_table *= "<td>"

        cur_table *= string(cur_matrix[ii, jj])

        cur_table *= "</td>"
      end

      cur_table *= "</tr>"

    end

    cur_table *= "</tbody>"

    cur_table *= "</table>"

    return HTML(cur_table)

  end

end

```

---

_[View the full topic](https://discourse.julialang.org/t/best-tool-for-printing-tables-in-jupyter-notebook/3548)._
