No node name error with XLSX

Hi,

I’m trying to write some code to import spreadsheets into julia, stack them together in an array, manipulate them a bit and save them into a csv.

I’m however having problems in importing programmatically the excel files as I get a ‘no node name’ error.

Location = pwd() 
Directory = readdir(Location)

for ii in eachindex(Directory)
    excel = XLSX.readxlsx(Directory[ii])
end 

But I found that the following sort of works:

myexl=XLSX.openxlsx(Directory[1], enable_cache=false)

but then I don’t know how to make myexl into an array. So my question is why the no node error usinf readxlsx and other derivative xlsx functions?

What I can do better to achieve my task?

not sure where the error comes from but you can get the data by calling

myex.workbook.sheets[1][:]

Or if you want to use a DataFrame then

myexcel = DataFrame(XLSX.readtable(filename, sheet, Column))

I gave up with the function XLSX.readxlsx() :frowning:

Here is my code snipped, for an excel file, where the first line with data starts at line number 4 and I know that in column one is the time and in column 2 the H2-flow:

fn_sel = "yourfilename.xlsx"
t_vec = Vector{Float64}(undef, 0)
ΦH2   = Vector{Float64}(undef, 0)
XLSX.openxlsx(fn_sel, enable_cache = false) do xf
    name_sheet1 = XLSX.sheetnames(xf)[1]
    sheet = xf[name_sheet1]
    for i_sr in XLSX.eachrow(sheet) # sr = sheet raw
        rownum = XLSX.row_number(i_sr)
        if rownum > 3 
            # println("t: ", i_sr["A"], " s")
            if ~isempty(i_sr["A"]) && ~isempty(i_sr["B"])
                push!(t_vec, i_sr["A"])
                push!(ΦH2, i_sr["B"])
            end
        end
    end
end

thanks, trying this solution now. A bit strange that I haven’t found a reliable way to programmaticaly import and read a bunch of excel files for analysis in Julia.

Meanwhile it is clear, why readxlsx() is not suitable for my XLSX-file:
# ERROR: Styles not found for this workbook. #233

Just submitted a related PR for XLSX.jl
You may be interested in trying that out and feedback here.

Meanwhile the PR is accepted and version XLSX v0.10.3 with the fix included is released.

Great work!!! - Thanks a lot! :slight_smile: