felipenoris / XLSX.jl

Excel file reader and writer for the Julia language.
https://felipenoris.github.io/XLSX.jl/stable
Other
271 stars 56 forks source link

Couldn't find template file `...blank.xlsx` error when creating a new file #250

Open YongHee-Kim opened 7 months ago

YongHee-Kim commented 7 months ago

I've noticed that XLSX couldn't generate a new excel file here is repro step

using XLSX 
f = XLSX.open_empty_template()

AssertionError: Couldn't find template file C:\Users\Ykim\.julia\artifacts\c0b84c4a80d13f58b3409f4a77d4a11455b5609e\blank.xlsx.
Stacktrace:
 [1] open_empty_template(sheetname::String; relocatable_data_path::String)
   @ XLSX C:\Users\Ykim\.julia\packages\XLSX\U2Bcm\src\write.jl:35
 [2] open_empty_template
   @ XLSX C:\Users\Ykim\.julia\packages\XLSX\U2Bcm\src\write.jl:29 [inlined]
 [3] open_empty_template()
   @ XLSX C:\Users\Ykim\.julia\packages\XLSX\U2Bcm\src\write.jl:29
 [4] top-level scope
   @ REPL[9]:1

I've looked into the artifact folder, but there is only sheet_template.html image

I'm on Windows10 and only anti virus enabled on my machine is windows defender. Perhaps windows deletes .xlsx files downloaded by Julia's package manager?

felipenoris commented 7 months ago

@YongHee-Kim which julia version are you using?

YongHee-Kim commented 7 months ago

I'm on 1.10.0

Julia Version 1.10.0
Commit 3120989f39 (2023-12-25 18:01 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 20 × 12th Gen Intel(R) Core(TM) i7-12700H
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, alderlake)
  Threads: 1 on 20 virtual cores

I did bit more investigation and I think what happened is that I've deleted "blank.xlsx" by accident, because XLSX.openxlsx isn't generating a new file but it just points to `blank.xlsx'

 julia> @__DIR__
"C:\\Users\\Ykim"

# it doesn't create a new file
julia> xf = XLSX.openxlsx(joinpath(@__DIR__, "foo.xlsx"), mode="w")
XLSXFile("C:\Users\Ykim\.julia\artifacts\c0b84c4a80d13f58b3409f4a77d4a11455b5609e\blank.xlsx") containing 1 Worksheet
            sheetname size          range
-------------------------------------------------
               Sheet1 1x1           A1:A1