There is an optional first argument to the pretty_table
function which is the io::IO
(input/output) argument. (See the first couple paragraphs of the pretty_table documentation.)
The following is untested but should work:
open("output.html", "w") do io
pretty_table(io, df; backend = Val(:html), alignment=:c)
end
The open function with a do
block is the safe way to open and close I/O streams in Julia. (It will close the stream even if the write fails with an error.)