Skip to content

write formula to Excel, formula treated as string #667

Description

@EanLee

Excel Type

  • XLSX
  • XLSM
  • CSV
  • OTHER

Upload Excel File

image

MiniExcel Version

1.34.1

Description

When you directly output formulas to an Excel file using MiniExcel, and then save it as a new file, the cells containing the formulas are treated as regular data, and the formulas themselves do not work. The formulas only become active after you manually enter the cells, edit the formulas, and press Enter.

And, I can’t find the relevant settings and instructions in the instructions for use in the readme.

var data = new List<Dictionary<string, object>>
{
    new Dictionary<string, object>
    {
        ["Institution"] = "Institution",
        ["Created"] = "Created",
        ["Formula"] = "Formula",
    },
    new Dictionary<string, object>
    {
        ["Institution"] = "BMC Inc.",
        ["Created"] = "2021-01-01",
        ["Formula"] = $"=SUM(A2:B2)"
    },
};

MiniExcel.SaveAs("test.xlsx", data, printHeader: false, overwriteFile: true, excelType: ExcelType.XLSX);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions