Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
2a89008a54 |
@@ -153,6 +153,16 @@ func main() {
|
||||
// Get an interface that we can work with to access the sub elements
|
||||
vslice := vislice.([]interface{})
|
||||
|
||||
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)
|
||||
// Close off the file
|
||||
if err := xlsx.SaveAs(outputFilename); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Check that the first element is what we expected
|
||||
if _, ok := vslice[0].(orderedmap.OrderedMap); !ok {
|
||||
error := fmt.Sprintf("Type of first vslice element is not an ordered map. It appears to be '%v'\n", reflect.TypeOf(vslice[0]))
|
||||
|
Reference in New Issue
Block a user