# Using prettytables with Pluto

**URL:** <https://discourse.julialang.org/t/using-prettytables-with-pluto/69895>\
**Category:** General Usage\
**Tags:** pluto\
**Created:** [October 16, 2021, 12:45pm UTC](https://discourse.julialang.org/t/using-prettytables-with-pluto/69895 "2021-10-16T12:45:48Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [October 17, 2021, 4:00pm UTC](https://discourse.julialang.org/t/using-prettytables-with-pluto/69895/21 "2021-10-17T16:00:03Z")

</div>

Thanks Clark and Rob! I think it is getting closer. What I am ultimately trying to do is print out the table in both REPL and Pluto. The printout in both cases will look similar to `DataFrame(chunks)`.

@goedman, I tried your code but there were a few problems. Although it now prints out a table with the ability to expand the view, it does not have labels or the correct number of columns. There should be 12 columns instead of 8.

As a point of reference, here is what it looks like in the REPL. I was hoping for something similar in Pluto. I’m still trying different suggestions, but nothing is quite working.

 ![example_table](https://global.discourse-cdn.com/julialang/original/3X/8/8/8818d0b1737e09ab1658c7b08794149148dd46cb.png)

Here is what Pluto currently displays:

 ![pluto_example_table](https://global.discourse-cdn.com/julialang/original/3X/d/b/db4f131a30bf8d1f39d5e0533ba0487ccf5e5575.png)

As you can see, it is missing columns and column labels.

---

<div class="post-metadata">

**Author:** ![goedman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goedman/32/217_2.png) [@goedman](https://discourse.julialang.org/u/goedman)\
**Post date:** [October 18, 2021, 6:10pm UTC](https://discourse.julialang.org/t/using-prettytables-with-pluto/69895/22 "2021-10-18T18:10:47Z")

</div>

Yip, we want all the features but don’t wanna wait 1s for DataFrames to load 🙂

---

<div class="post-metadata">

**Author:** ![weymouth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/weymouth/32/15839_2.png) [@weymouth](https://discourse.julialang.org/u/weymouth)\
**Post date:** [March 2, 2024, 9:07am UTC](https://discourse.julialang.org/t/using-prettytables-with-pluto/69895/23 "2024-03-02T09:07:11Z")

</div>

Did this ever get finalized? I would like to display tables in a Pluto notebook and while pretty\_tables lets me pick various backends, they don’t display as a Pluto object.

---

<div class="post-metadata">

**Author:** ![ranocha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ranocha/32/35588_2.png) [@ranocha](https://discourse.julialang.org/u/ranocha)\
**Post date:** [September 20, 2024, 1:46pm UTC](https://discourse.julialang.org/t/using-prettytables-with-pluto/69895/24 "2024-09-20T13:46:09Z")

</div>

Something like

```julia
pretty_table(HTML, rand(4, 2))

```

works for me:

 ![Screenshot 2024-09-20 at 15.45.04](https://global.discourse-cdn.com/julialang/original/3X/4/f/4fb78dff6dac8acc935b92c9e897007bcf9a7f8e.png)

---

<div class="post-metadata">

**Author:** ![adannenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adannenberg/32/7869_2.png) [@adannenberg](https://discourse.julialang.org/u/adannenberg)\
**Post date:** [November 23, 2024, 9:59pm UTC](https://discourse.julialang.org/t/using-prettytables-with-pluto/69895/25 "2024-11-23T21:59:13Z")

</div>

pretty\_table(HTML, …) looks much nicer in Pluto than pretty\_table(…) which (I think) defaults to the text backend. However, unlike the text backend, pretty\_table(HTML,…) shows the entire table rather than having a vertical scrollbar for tables with many rows. Is there an override for this default, i.e. can one have the better looking display of the HTML backend and still have a scrollable display?

for others who are interested in this: i found a way but it’s ugly. i’m hoping someone can point out an argument to pretty\_table that i’m unaware of.

here’s my ugly solution for pretty printing dataframe df in Pluto:

```julia
using HypertextLiteral, PrettyTables
html_table = pretty_table(String, df, backend = Val(:html),formatters =...)
scrollable_table = @htl("""
    <div style="max-height: 400px; overflow-y: auto; border: 1px solid #ccc;">
        $(HTML(html_table))
    </div>
""")
scrollable_table

```

as a further addendum: it would be great to have the column headers remain visible while scrolling down in either the text or html backends. is that possible?

[Previous page](https://discourse.julialang.org/t/using-prettytables-with-pluto/69895.md?page=1)
