Skip to content

cecoeco/HTMLTables.jl

Repository files navigation

CI test DOI Documentation Dev Package Statistics Style: Blue

HTMLTables

Julia package for reading and writing HTML tables.

Installation: use this command in the Julia REPL: using Pkg; Pkg.add("HTMLTables")

Examples:

create an HTML table using a DataFrame:

using HTMLTables, DataFrames

df = DataFrame(x=[10, 40, 70], y=[20, 50, 80], z=[30, 60, 90])

writetable(stdout, df, styles=false, footer=false)

output:

x y z
10 20 30
40 50 60
70 80 90

create a DataFrame from parsing HTML:

using HTMLTables, DataFrames

url = "https://www.w3schools.com/html/html_tables.asp"

df = readtable(url, DataFrame)

println(df)

output:

6×3 DataFrame
 Row │ Company                       Contact           Country
     │ String                        String            String
─────┼─────────────────────────────────────────────────────────
   1 │ Alfreds Futterkiste           Maria Anders      Germany
   2 │ Centro comercial Moctezuma    Francisco Chang   Mexico
   3 │ Ernst Handel                  Roland Mendel     Austria
   4 │ Island Trading                Helen Bennett     UK
   5 │ Laughing Bacchus Winecellars  Yoshi Tannamuri   Canada
   6 │ Magazzini Alimentari Riuniti  Giovanni Rovelli  Italy