aboutsummaryrefslogtreecommitdiffstats
path: root/reader/reader.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--reader/reader.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/reader/reader.go b/reader/reader.go
index 449b8ba..4b9c425 100644
--- a/reader/reader.go
+++ b/reader/reader.go
@@ -7,6 +7,7 @@ import (
"io"
"io/ioutil"
"log"
+ "path/filepath"
"strings"
"github.com/tealeg/xlsx"
@@ -174,3 +175,16 @@ func Extract(dm string, ssheet string) ExtractedData {
}
return outer
}
+
+//GetTargetFiles finds all xlsx and xlsm files in directory.
+func GetTargetFiles(path string) ([]string, error) {
+ fullpath := strings.Join([]string{path, "*.xlsx"}, "")
+ output, err := filepath.Glob(fullpath)
+ if err != nil {
+ return nil, err
+ }
+ if output == nil {
+ return nil, fmt.Errorf("cannot find any xlsx files in %s\n", path)
+ }
+ return output, nil
+}