diff --git a/cmd/main/main.go b/cmd/main/main.go index 48d99cf..01550ea 100644 --- a/cmd/main/main.go +++ b/cmd/main/main.go @@ -156,6 +156,24 @@ func main() { if len(vslice) < 1 { // There was no data but lets just log that and close off the empty workbook fmt.Printf("No data found contained in top-level json key '%s', no work to do.\n", parentNode) + + // Create new file + xlsx = createWorkbook(worksheetName, outputFilename) + + // Run code to add column names to the first row of the workbook based off the keyOrder, if defined + if len(config.keyOrder) > 0 { + + // Create a slice to hold the values + var columnHeadings []string + + // Iterate over the map and append each value to the slice + for _, value := range config.keyOrder { + columnHeadings = append(columnHeadings, value) + } + + createHeadingRow(xlsx, worksheetName, columnHeadings) + } + // Close off the file if err := xlsx.SaveAs(outputFilename); err != nil { log.Fatal(err)