Skip to content
Node: papaparsegithub.com/sahilkhaire/gox/csv

Write

Overview

Write writes rows to w using columns for field order (header row).

Part of the csv package — Node.js analog: papaparse.

Signature

go
func Write(ctx context.Context, w io.Writer, rows []map[string]string, columns []string) error

Compare: Node.js · Standard Go · gox

js
// Typical papaparse pattern in Node.js
go
r := csv.NewReader(f)
records, err := r.ReadAll()
go
import "github.com/sahilkhaire/gox/csv"

err := csv.Write(ctx, w, rows, []string{"name", "age"})

Example

go
import "github.com/sahilkhaire/gox/csv"

err := csv.Write(ctx, w, rows, []string{"name", "age"})

Tips

Import github.com/sahilkhaire/gox/csv and call Write directly. See the comparison below for the standard library equivalent.

Standard library alternative

Use the standard library directly:

go
r := csv.NewReader(f)
records, err := r.ReadAll()

Back to csv package overview

MIT Licensed · Built for Node.js developers moving to Go