From 8ac4a42c58f6dfb65ddfaef38d137ab1b2280e41 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Tue, 3 Dec 2019 17:17:10 +0000 Subject: removed all coords code --- reader/reader.go | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) (limited to 'reader/reader.go') diff --git a/reader/reader.go b/reader/reader.go index 5ba40ae..22dd003 100644 --- a/reader/reader.go +++ b/reader/reader.go @@ -10,14 +10,10 @@ import ( "path/filepath" "strings" + "github.com/hammerheadlemon/coords" "github.com/tealeg/xlsx" ) -const ( - maxCols = 16384 - maxAlphabets = (maxCols / 26) - 1 -) - type ( // Data from the sheet. SheetData map[string]ExtractedCell @@ -27,8 +23,6 @@ type ( ExtractedData map[string]map[string]xlsx.Cell ) -var colstream = cols(maxAlphabets) - //DatamapLine - a line from the datamap. type DatamapLine struct { Key string @@ -96,30 +90,6 @@ func ReadDML(path string) ([]DatamapLine, error) { return s, nil } -//alphabet generates all the letters of the alphabet. -func alphabet() []string { - letters := make([]string, 26) - for idx := range letters { - letters[idx] = string('A' + byte(idx)) - } - return letters -} - -//cols generates the alpha column compont of Excel cell references -//Adds n alphabets to the first (A..Z) alphabet. -func cols(n int) []string { - out := alphabet() - alen := len(out) - tmp := make([]string, alen) - copy(tmp, out) - for cycle := 0; cycle < n; cycle++ { - for y := 0; y < alen; y++ { - out = append(out, out[(cycle+2)-2]+tmp[y]) - } - } - return out -} - //ReadXLSX returns the file's data as a map, // keyed on sheet name. All values are returned as strings. // Paths to a datamap and the spreadsheet file required. @@ -139,7 +109,7 @@ func ReadXLSX(ssheet string) FileData { for colLidx, cell := range row.Cells { ex := ExtractedCell{ Cell: cell, - Col: colstream[colLidx], + Col: coords.Colstream[colLidx], Row: rowLidx + 1, Value: cell.Value} cellref := fmt.Sprintf("%s%d", ex.Col, ex.Row) -- cgit v1.2.3