Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

Commit

Permalink
fix(document): catch the error if there is no data in sheet (#296)
Browse files Browse the repository at this point in the history
Because

- we cannot read pivot table with the current package

This commit

- catch the error if there is no data in sheet
  • Loading branch information
chuang8511 authored Aug 23, 2024
1 parent aa20a16 commit 21bebbd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions operator/document/v0/markdown_transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ func (t XlsxToMarkdownTransformer) Transform() (string, error) {
return "", fmt.Errorf("failed to get rows: %w", err)
}

if len(rows) == 0 {
result += fmt.Sprintf("# %s\n", sheet)
result += "No data found\n\n"
continue
}

result += fmt.Sprintf("# %s\n", sheet)
result += util.ConvertDataFrameToMarkdownTable(rows)
result += "\n\n"
Expand Down

0 comments on commit 21bebbd

Please sign in to comment.