fix: improve ai table file handling

This commit is contained in:
richjohnrambo
2026-09-30 10:02:00 +08:00
parent 1bcce3cdde
commit 47a10c93be
5 changed files with 334 additions and 15 deletions
+11 -3
View File
@@ -92,12 +92,17 @@ func parseXLSX(path string) (Profile, error) {
}
defer f.Close()
for _, sheet := range f.GetSheetList() {
rows, err := f.GetRows(sheet)
iter, err := f.Rows(sheet)
if err != nil {
continue
}
cleaned := make([][]string, 0, min(len(rows), maxRows))
for _, row := range rows {
cleaned := make([][]string, 0, maxRows)
for iter.Next() {
row, err := iter.Columns()
if err != nil {
_ = iter.Close()
return Profile{}, err
}
if emptyRow(row) {
continue
}
@@ -106,6 +111,9 @@ func parseXLSX(path string) (Profile, error) {
break
}
}
if err := iter.Close(); err != nil {
return Profile{}, err
}
if len(cleaned) > 0 {
return profileRows(cleaned), nil
}