Skip to content

Instantly share code, notes, and snippets.

@mottet-dev
Last active June 15, 2019 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mottet-dev/0d95aa2ce982b966b46c941f49032bc9 to your computer and use it in GitHub Desktop.
Save mottet-dev/0d95aa2ce982b966b46c941f49032bc9 to your computer and use it in GitHub Desktop.
CSV Writer - Go Colly Advanced
func main() {
fileName := "amazon_products.csv"
file, err := os.Create(fileName)
if err != nil {
log.Fatalf("Could not create %s", fileName)
}
defer file.Close()
writer := csv.NewWriter(file)
defer writer.Flush()
writer.Write([]string{"Product Name", "Stars", "Price"})
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment