Description
It seems excelize evaluates all function arguments before calling a function, which doesn't work well with LOOKUP (HLOOKUP, VLOOKUP ...) functions, especially if table range is large.
E.g. =VLOOKUP(C1, A:XFD, 2) will try to calculate all the cells in the table, instead of just lazily calculating cells in A column, and then calculate a corresponding single cell from B column.
Steps to reproduce the issue
-
Add this simple table to the project
vlookup.xlsx
-
Run this code
package main
import (
"fmt"
"github.com/xuri/excelize/v2"
)
func unwrap[T any](v T, err error) T {
if err != nil {
panic(err)
}
return v
}
func main() {
file := unwrap(excelize.OpenFile("vlookup.xlsx"))
val := unwrap(file.CalcCellValue("Sheet1", "C2"))
fmt.Println(val)
}
Describe the results you received
It takes ages to calculate this field value.
Describe the results you expected
It should be instant to calculate this cell value.
Go version
1.23.4
Excelize version or commit ID
2.9.0
Environment
Validations
Description
It seems excelize evaluates all function arguments before calling a function, which doesn't work well with LOOKUP (HLOOKUP, VLOOKUP ...) functions, especially if table range is large.
E.g.
=VLOOKUP(C1, A:XFD, 2)will try to calculate all the cells in the table, instead of just lazily calculating cells in A column, and then calculate a corresponding single cell from B column.Steps to reproduce the issue
Add this simple table to the project
vlookup.xlsx
Run this code
Describe the results you received
It takes ages to calculate this field value.
Describe the results you expected
It should be instant to calculate this cell value.
Go version
1.23.4
Excelize version or commit ID
2.9.0
Environment
Validations