Dear all,
What’s wrong with this error?
julia> XLSX.readtable("AREAER.xlsx", "Sheet1")
ERROR: Shared Strings Table not found for this workbook.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] sst_load!(workbook::XLSX.Workbook)
@ XLSX ~/.julia/packages/XLSX/E1Mu6/src/sst.jl:95
[3] sst_unformatted_string
@ ~/.julia/packages/XLSX/E1Mu6/src/sst.jl:130 [inlined]
[4] sst_unformatted_string
@ ~/.julia/packages/XLSX/E1Mu6/src/sst.jl:141 [inlined]
[5] sst_unformatted_string
@ ~/.julia/packages/XLSX/E1Mu6/src/sst.jl:142 [inlined]
[6] sst_unformatted_string
@ ~/.julia/packages/XLSX/E1Mu6/src/sst.jl:143 [inlined]
[7] getdata(ws::XLSX.Worksheet, cell::XLSX.Cell)
@ XLSX ~/.julia/packages/XLSX/E1Mu6/src/cell.jl:146
[8] getdata
@ ~/.julia/packages/XLSX/E1Mu6/src/stream.jl:289 [inlined]
[9] eachtablerow(sheet::XLSX.Worksheet; first_row::Nothing, column_labels::Nothing, header::Bool, stop_in_empty_row::Bool, stop_in_row_function::Nothing)
@ XLSX ~/.julia/packages/XLSX/E1Mu6/src/table.jl:182
[10] gettable(sheet::XLSX.Worksheet; first_row::Nothing, column_labels::Nothing, header::Bool, infer_eltypes::Bool, stop_in_empty_row::Bool, stop_in_row_function::Nothing)
@ XLSX ~/.julia/packages/XLSX/E1Mu6/src/table.jl:551
[11] #30
@ ~/.julia/packages/XLSX/E1Mu6/src/read.jl:578 [inlined]
[12] openxlsx(f::XLSX.var"#30#31"{Nothing, Nothing, Bool, Bool, Bool, Nothing, String}, filepath::String; mode::String, enable_cache::Bool)
@ XLSX ~/.julia/packages/XLSX/E1Mu6/src/read.jl:135
[13] #readtable#29
@ ~/.julia/packages/XLSX/E1Mu6/src/read.jl:577 [inlined]
[14] readtable(filepath::String, sheet::String)
@ XLSX ~/.julia/packages/XLSX/E1Mu6/src/read.jl:577
[15] top-level scope
@ REPL[41]:1
I try ExcelFiles
, it also gets an error.
julia> using ExcelFiles
julia> df = load("AREAER.xlsx", "Sheet1") |> DataFrame
ERROR: PyError ($(Expr(:escape, :(ccall(#= /Users/zhangdeliang/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'xlrd.biffh.XLRDError'>
XLRDError('Excel xlsx file; not supported')
File "/Users/zhangdeliang/.julia/conda/3/lib/python3.9/site-packages/xlrd/__init__.py", line 170, in open_workbook
raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')
Stacktrace:
[1] pyerr_check
@ ~/.julia/packages/PyCall/7a7w0/src/exception.jl:62 [inlined]
[2] pyerr_check
@ ~/.julia/packages/PyCall/7a7w0/src/exception.jl:66 [inlined]
[3] _handle_error(msg::String)
@ PyCall ~/.julia/packages/PyCall/7a7w0/src/exception.jl:83
[4] macro expansion
@ ~/.julia/packages/PyCall/7a7w0/src/exception.jl:97 [inlined]
[5] #107
@ ~/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:43 [inlined]
[6] disable_sigint
@ ./c.jl:458 [inlined]
[7] __pycall!
@ ~/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:42 [inlined]
[8] _pycall!(ret::PyCall.PyObject, o::PyCall.PyObject, args::Tuple{String}, nargs::Int64, kw::Ptr{Nothing})
@ PyCall ~/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:29
[9] _pycall!
@ ~/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:11 [inlined]
[10] #_#114
@ ~/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:86 [inlined]
[11] (::PyCall.PyObject)(args::String)
@ PyCall ~/.julia/packages/PyCall/7a7w0/src/pyfncall.jl:86
[12] openxl(filename::String)
@ ExcelReaders ~/.julia/packages/ExcelReaders/PgE1r/src/ExcelReaders.jl:64
[13] getiterator(file::ExcelFiles.ExcelFile)
@ ExcelFiles ~/.julia/packages/ExcelFiles/NtqPa/src/ExcelFiles.jl:0
[14] nondatavaluerows(x::ExcelFiles.ExcelFile)
@ Tables ~/.julia/packages/Tables/PxO1m/src/tofromdatavalues.jl:24
[15] columns
@ ~/.julia/packages/Tables/PxO1m/src/fallbacks.jl:259 [inlined]
[16] DataFrame(x::ExcelFiles.ExcelFile; copycols::Nothing)
@ DataFrames ~/.julia/packages/DataFrames/zqFGs/src/other/tables.jl:58
[17] DataFrame
@ ~/.julia/packages/DataFrames/zqFGs/src/other/tables.jl:49 [inlined]
[18] |>(x::ExcelFiles.ExcelFile, f::Type{DataFrame})
@ Base ./operators.jl:966
[19] top-level scope
@ REPL[48]:1
I try to save the excel file as CSV file, then it works well. But why can not I use XLSX
?
julia> CSV.read("AREAER.csv", DataFrame)
5602×8 DataFrame
Row │ Year IFS Code Country Code Index Category ⋯
│ Int64 Int64 String7 Int64 String31 String ⋯
──────┼─────────────────────────────────────────────────────────────────────────
1 │ 1999 924 China 71 I. Status under IMF Articles ⋯
2 │ 1999 924 China 280 I.A. Date of membership
3 │ 1999 924 China 278 I.A.1. Article VIII
4 │ 1999 924 China 279 I.A.2. Article XIV
5 │ 1999 924 China 291 II.A. Restrictions and/or multi ⋯
6 │ 1999 924 China 197 II.B. Exchange measures imposed
7 │ 1999 924 China 199 II.B.1. In accordance with IMF Ex
8 │ 1999 924 China 198 II.B.2. Other security restrictio
⋮ │ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋱
5595 │ 2020 924 China 312 XII.B.2.b. Limits (max.) on investme ⋯
5596 │ 2020 924 China 313 XII.B.2.c. Limits (min.) on investme
5597 │ 2020 924 China 314 XII.B.2.d. Currency-matching regulat
5598 │ 2020 924 China 330 XII.B.3. Investment firms and coll
5599 │ 2020 924 China 331 XII.B.3.a. Limits (max.) on securiti ⋯
5600 │ 2020 924 China 332 XII.B.3.b. Limits (max.) on investme
5601 │ 2020 924 China 333 XII.B.3.c. Limits (min.) on investme
5602 │ 2020 924 China 334 XII.B.3.d. Currency-matching regulat
3 columns and 5586 rows omitted
If you can, file an issue with the repo and share the workbook.
As the error message says
xlrd does not support opening xlsx files, which is something many people ask about
Recent versions of xlrd do not support xlsx files. See xlrd 2.0.1 issues · Issue #98 · queryverse/ExcelReaders.jl · GitHub
Install xlrd 1.2.0 or use XLSX.jl instead.