updated logging

This commit is contained in:
2023-05-31 10:38:55 +10:00
parent 590d3e3407
commit 482e5deb6e

View File

@@ -85,6 +85,10 @@ func main() {
// Assume that our content is within the first top-level key
topLevel := o.Keys()
fmt.Printf("Found %d top-level keys in json data\n", len(topLevel))
for i, key := range topLevel {
fmt.Printf("[%d] : %s\n", i, key)
}
// Check for config embedded in json
if strings.EqualFold(topLevel[0], configNode) && len(topLevel) > 1 {
@@ -398,13 +402,12 @@ func modifyWorkbook(worksheetName string, outputFilename string) *excelize.File
}
func createHeadingRow(xlsx *excelize.File, worksheetName string, columnNames []string) {
fmt.Printf("Creating excel workbook with following headings : '%v'\n", columnNames)
var cell string
row := 1
column := 1
if len(config.keyOrder) > 0 {
fmt.Printf("Setting heading order as per config key-order\n")
fmt.Printf("Creating excel workbook with heading order as per config key-order\n")
// Check that the number of specified columns matches input data
if len(config.keyOrder) != len(columnNames) {
error := fmt.Sprintf("Column order specified in json key-order but mismatch found in json data. %d specifed columns does not match %d found columns.", len(config.keyOrder), len(columnNames))
@@ -419,6 +422,7 @@ func createHeadingRow(xlsx *excelize.File, worksheetName string, columnNames []s
column++
}
} else {
fmt.Printf("Creating excel workbook with following headings : '%v'\n", columnNames)
// Add the header row
for i := 0; i < len(columnNames); i++ {
cell, _ = excelize.CoordinatesToCellName(column, row)