... | ... |
@@ -29,3 +29,5 @@ |
29 | 29 |
new option for -fontsize and -fontname |
30 | 30 |
new option for -headerlines |
31 | 31 |
|
32 |
+2018-06-29 0.3.3 |
|
33 |
+ Bugfix for the -dateformat parameter (now works as intended) |
... | ... |
@@ -11,11 +11,12 @@ license below), you may download the binary. |
11 | 11 |
|
12 | 12 |
Here are the SHA-256 checksums for the binaries: |
13 | 13 |
|
14 |
- 86fab8cdb756d612391bdfca36641414424cb0cfe7c9c196329124976f3d3a8c csv2xlsx_386.exe |
|
15 |
- 91b94bb4c0acf91bcd2b3874d7ab7f96e204e6c0acb1d0119694bb740dedb6f4 csv2xlsx_amd64.exe |
|
16 |
- d1b3dc8bfa72647f4e92dbafede0ee729ccb488a7b2a400304634bf03439b744 csv2xlsx_linux_386 |
|
17 |
- 3e8661e7ef681c796452736e9004f19653ccf01c916f3c6a8b1e67d99f1e0ab5 csv2xlsx_linux_amd64 |
|
18 |
- 2933cdca783beca8fbcfccc2d396f4ec115c898a9f69680d6c64806ac84e1804 csv2xlsx_osx |
|
14 |
+ d65d1e3c81572e09d5807bd05da0c4444583cb0bb47004d1b18b98567cfbf113 csv2xlsx_386.exe |
|
15 |
+ 1d03d57ba4e274ab258a0ac7b8d4214b56cc7ade0ebb8b852aa2109bf000a4bd csv2xlsx_amd64.exe |
|
16 |
+ 81587129a57c925ffbd8e152b4728ce1c147f05a556ecb9cd4551d738d070c4a csv2xlsx_linux_386 |
|
17 |
+ 102903ddc4d57cc971438772def756780500d8e32a5892f8adc1282e1cc56ea2 csv2xlsx_linux_amd64 |
|
18 |
+ 98f0976b8c78c820965dbc0a9f869a911892f566ccdf16040d53d0a8ae0eccbd csv2xlsx_osx |
|
19 |
+ |
|
19 | 20 |
|
20 | 21 |
### Usage |
21 | 22 |
|
... | ... |
@@ -39,6 +39,7 @@ var ( |
39 | 39 |
parmAbortOnError bool |
40 | 40 |
parmShowVersion bool |
41 | 41 |
parmAutoFormula bool |
42 |
+ parmIgnoreEmpty bool |
|
42 | 43 |
rowRangeParsed map[int]string |
43 | 44 |
colRangeParsed map[int]string |
44 | 45 |
workBook *xlsx.File |
... | ... |
@@ -160,6 +161,7 @@ func parseCommandLine() { |
160 | 161 |
flag.BoolVar(&parmHelp, "h", false, "display usage information") |
161 | 162 |
flag.BoolVar(&parmHelp, "?", false, "display usage information") |
162 | 163 |
flag.BoolVar(&parmShowVersion, "version", false, "display version information") |
164 |
+ flag.BoolVar(&parmIgnoreEmpty, "ignoreempty", true, "do not display warnings for empty cells") |
|
163 | 165 |
flag.Parse() |
164 | 166 |
|
165 | 167 |
t, err := strconv.Unquote(`"` + tmpStr + `"`) |
... | ... |
@@ -174,6 +176,16 @@ func parseCommandLine() { |
174 | 176 |
os.Exit(0) |
175 | 177 |
} |
176 | 178 |
|
179 |
+ r := strings.NewReplacer("YYYY", "2006", |
|
180 |
+ "MM", "01", |
|
181 |
+ "DD", "02", |
|
182 |
+ "HH", "15", |
|
183 |
+ "MI", "04", |
|
184 |
+ "SS", "04") |
|
185 |
+ |
|
186 |
+ // Replace all pairs. |
|
187 |
+ parmDateFormat = r.Replace(parmDateFormat) |
|
188 |
+ |
|
177 | 189 |
if parmHelp { |
178 | 190 |
fmt.Printf("You are running version %s of %s\n\n", versionInfo, filepath.Base(os.Args[0])) |
179 | 191 |
flag.Usage() |
... | ... |
@@ -351,6 +363,15 @@ func writeCellContents(cell *xlsx.Cell, colString, colType string, rownum, colnu |
351 | 363 |
if parmAutoFormula && []rune(colString)[0] == '=' { |
352 | 364 |
colType = "formula" |
353 | 365 |
} |
366 |
+ // check for content to process and |
|
367 |
+ // process the "Ignore Warnings On Empty Cells" flag |
|
368 |
+ if colString == "" { |
|
369 |
+ if !parmIgnoreEmpty { |
|
370 |
+ fmt.Println(fmt.Sprintf("Warning: Cell (%d, %d) is empty.", rownum, colnum)) |
|
371 |
+ } |
|
372 |
+ return true |
|
373 |
+ } |
|
374 |
+ // type dependent write |
|
354 | 375 |
switch colType { |
355 | 376 |
case "text": |
356 | 377 |
cell.SetString(colString) |
... | ... |
@@ -409,7 +430,7 @@ func processDataColumns(excelRow *xlsx.Row, rownum int, csvLine []string) { |
409 | 430 |
if processColumn { |
410 | 431 |
cell := excelRow.AddCell() |
411 | 432 |
isHeader := (parmHeaderLines > 0) || !parmNoHeader |
412 |
- if isHeader && (rownum <= parmHeaderLines) { |
|
433 |
+ if isHeader && (rownum < parmHeaderLines) { |
|
413 | 434 |
// special case for the title row |
414 | 435 |
cell.SetString(csvLine[colnum]) |
415 | 436 |
if colType == "number" || colType == "currency" { |