Converting XLSX to DataFrame

Hello everyone,

I am trying to read an xlsx file in julia :

Materials = XLSX.readtable("MatData.xlsx","Sheet1"; header = true)

In order to be able to make changes/calculations on it I want to convert it into a DataFrame:

materials = DataFrame(Materials)

I then get this error, does anyone know why?

ArgumentError: 'Tuple{Vector{Any}, Vector{Symbol}}' iterates 'Vector{Any}' values, which doesn't satisfy the Tables.jl `AbstractRow` interface

Thank you !

Hi @jnewbie ,

XLSX.jl has a tutorial section on how to do this:
https://felipenoris.github.io/XLSX.jl/stable/tutorial/#Read-Tabular-Data

you need the ... to splat Materials into a sequence of arguments for the DataFrame constructor.
This is probably not super performant, but since it’s part of the tutorial, I assume that’s currently the best way to do this.

1 Like

Thank you it works perfectly