Hi, i am new to golang. I am currently trying to export my data to an excel. I am using tealeg’s xlsx package for doing this. The rows i am trying to write to xlsx are multidimensional string objects. However, these data consists of date, float and int datatypes which is how i want it to be stored in excel. Below is an example of how my data looks like.
[
"ESSEN",
"2019-08-24 00:00:00",
"0.9706181883811951"
],
[
"ESSEN",
"2019-08-24 00:00:00",
"0.9706181883811951"
],
[
"ESSEN",
"2019-08-24 00:00:00",
"0.9706181883811951"
]
Below is the code:
// Create header row and insert values strings as bold string.
headerRow := sheet.AddRow()
headerStyle := xlsx.NewStyle()
headerStyle.Font.Bold = true
for _, val := range headers {
cell := headerRow.AddCell()
cell.SetValue(val)
cell.SetStyle(headerStyle)
}
// Put remaining row values.
for _, rowData := range rows {
row := sheet.AddRow()
for _, val := range rowData {
cell := row.AddCell()
cell.SetValue(val)
}
}
After exporting these data to excel i see that these datatypes are stored as string rather than Date, float or int. Is there anyway to solve this problem?