summaryrefslogtreecommitdiff
path: root/header.go
diff options
context:
space:
mode:
authorGeorge Abbott <george@gabbott.dev>2023-11-03 21:06:29 +0000
committerGeorge Abbott <george@gabbott.dev>2023-11-03 21:06:29 +0000
commit0faa29f2c11a6d906f340397eca5c4bc6d0f1dc6 (patch)
tree1f67a2956dba869c3c35a1af4c533530e45f9b57 /header.go
Commit allHEADmaster
Diffstat (limited to 'header.go')
-rw-r--r--header.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/header.go b/header.go
new file mode 100644
index 0000000..d553945
--- /dev/null
+++ b/header.go
@@ -0,0 +1,22 @@
+package badtudexo
+
+import (
+ xl "git.gabbott.dev/george/excelize/v2"
+ // st "saggytrousers"
+)
+
+
+// Return the header of a given file, which must be the first row.
+func GetHeader(file *xl.File, sheet string) ([]string, error) {
+ rows, err := file.Rows(sheet)
+ if err != nil {
+ return []string{}, err
+ }
+
+ rows.Next()
+ header, err := rows.Columns()
+ if err != nil {
+ return []string{}, err
+ }
+ return header, nil
+}