Skip to content

Commit

Permalink
Add support for string formula cells
Browse files Browse the repository at this point in the history
String formula cells are marked with type "str". Make this library
recognize string formula type and return TypeString.
  • Loading branch information
WKBae committed Oct 26, 2023
1 parent 04b920a commit 6cafa19
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rows.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func (x *XlsxFile) getCellType(r rawCell) CellType {
return TypeDateTime
}
return TypeNumerical
case "s", "inlineStr":
case "s", "inlineStr", "str":
return TypeString
default:
return TypeString
Expand Down
10 changes: 10 additions & 0 deletions rows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ var cellValueTests = []struct {
Cell: rawCell{Type: "s", Value: &offsetTooHighSharedString},
Error: "attempted to index value 32 in shared strings of length 4",
},
{
Name: "String Formula",
Cell: rawCell{Type: "str", Value: &inlineStr},
Expected: inlineStr,
},
{
Name: "Unknown type",
Cell: rawCell{Type: "potato", Value: &inlineStr},
Expand Down Expand Up @@ -142,6 +147,11 @@ var cellTypeTests = []struct {
Cell: rawCell{Type: "s", Value: &sharedString},
Expected: TypeString,
},
{
Name: "Valid String Formula",
Cell: rawCell{Type: "str", Value: &inlineStr},
Expected: TypeString,
},
{
Name: "Unknown type",
Cell: rawCell{Type: "potato", Value: &inlineStr},
Expand Down

0 comments on commit 6cafa19

Please sign in to comment.