Skip to content

Add support for table referencing #2062

@IvanHristov98

Description

@IvanHristov98

Description

The library currently doesn't support table referencing. E.g. a formula like =INDEX(MyTable[Column1], 2) isn't calculated correctly. It returns an invalid reference error. It is interesting though that the library already has a notion of tables.

The goal of this issue is to add support for table referencing.

Steps to reproduce the issue:

  1. Create a table with f.AddTable("Sheet1", &Table{Range: "A2:C5", Name: "MyTable"}).
  2. Add a cell formula f.SetCellFormula("Sheet1", "A1", "=INDEX(MyTable[Column1], 2)")
  3. Set the value of cell A3 to be "Foo" with f.SetCellValue("Sheet1", "A3", "Foo")
  4. Calculate the cell value f.CalcCellValue("Sheet1", "A1") and receive an error invalid reference.

Describe the results you received:

An error called invalid reference.

Describe the results you expected:

To receive "Foo" after calculating the value of "A1".

Output of go version:

go version go1.23.2 darwin/arm64

Excelize version or commit ID:

caf22e4974afa377baeac21803de3923fd78e627

Environment details (OS, Microsoft Excel™ version, physical, etc.):

Apple M3 Pro, macOS 14.4 (23E214)

Received the result with an xlsx file generated by gsheet.

Notes

I think I already implemented the feature. There should be a reference PR with the proposed change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions