For a write using go or excel Library

The need to write a task with golang,
Read data from the SQL database, after handling in pure form excel (not CSV).

Many of the Internet, the github.com/tealeg/xlsx library can only be read but not write Excel.

The best way is to find the library can be used.

It is not a command line tool can do, is to use golang to generate CSV, and program call external tools to CSV Excel.

Started by Deborah at February 02, 2016 - 2:38 PM

This is how can read but not write? How can I read can also write?

Posted by Julie at February 11, 2016 - 3:13 PM

There are examples of it ?

Developers official stated that this is the excel reader. But the official website also give an example of reading.

Posted by Deborah at December 30, 2016 - 12:45 PM

Do not know CSV conform to the requirements of you not?

package main

import (
"os"
"encoding/csv"
)

func main() {
f, err := os.Create("haha2.xls")
if err != nil {
panic(err)
}
defer f.Close()

f.WriteString("\xEF\xBB\xBF") // Write to UTF-8 BOM

w := csv.NewWriter(f)
w.Write([]string{"Number "," name "," age"})
w.Write([]string{"1","Zhang San","23"})
w.Write([]string{"2","Li Si","24"})
w.Write([]string{"3","Wang Wu","25"})
w.Write([]string{"4","Zhao Liu","26"})
w.Flush()
}

Posted by Jared at January 09, 2017 - 1:38 PM

Use the official encoding/csv

Posted by Uriah at January 09, 2017 - 2:19 PM