Skip to content

Add support for Excel-native template files (.xltx files) #293

@gyansinha

Description

@gyansinha

I've saved and read in a template file (xltx extension). I then overwrite cell values in a sheet using values from a dataframe and then write it out to an xlsx file. Excel can't seem to recognize this file though the code works fine with no errors - the extension needs to xltx. Am I just missing the plot here in terms of what needs to be done?

letters = collect('A':'Z')
xf = XLSX.open_xlsx_template(abspath("excel/xxx_template.xltx"))
sh = xf["DM"]
nr, nc = size(res_df)
for (i, c) in enumerate(names(res_df))
    for j in 1:nr
        cref = "$(letters[i])$(j+1)"
        sh[cref] = res_df[j, i] 
    end
end
XLSX.writexlsx("excel/test_format.xlsx", xf, overwrite=true)

XLSX v0.10.5-dev `https://github.com/TimG1964/XLSX.jl#Bug-fixing-post-#289`

I feel like this should be a standard use case - set up a template and then refresh the values from a script.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions