Categorygithub.com/goark/csvdata
modulepackage
0.7.3
Repository: https://github.com/goark/csvdata.git
Documentation: pkg.go.dev

# README

csvdata -- Reading CSV Data

check vulns lint status GitHub license GitHub release

This package is required Go 1.16 or later.

Migrated repository to github.com/goark/csvdata

Import

import "github.com/goark/csvdata"

Usage

package csvdata_test

import (
	"fmt"

	"github.com/goark/csvdata"
)

func ExampleNew() {
	file, err := csvdata.OpenFile("testdata/sample.csv")
	if err != nil {
		fmt.Println(err)
		return
	}
	rc := csvdata.NewRows(csvdata.New(file), true)
	defer rc.Close()

	if err := rc.Next(); err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(rc.Column("name"))
	// Output:
	// Mercury
}

Reading from Excel file

package exceldata_test

import (
	"fmt"

	"github.com/goark/csvdata"
	"github.com/goark/csvdata/exceldata"
)

func ExampleNew() {
	xlsx, err := exceldata.OpenFile("testdata/sample.xlsx", "")
	if err != nil {
		fmt.Println(err)
		return
	}
	r, err := exceldata.New(xlsx, "")
	if err != nil {
		fmt.Println(err)
		return
	}
	rc := csvdata.NewRows(r, true)
	defer rc.Close() //dummy

	if err := rc.Next(); err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(rc.Column("name"))
	// Output:
	// Mercury
}

Reading from LibreOffice Calc file

package calcdata_test

import (
	"fmt"

	"github.com/goark/csvdata"
	"github.com/goark/csvdata/calcdata"
)

func ExampleNew() {
	ods, err := calcdata.OpenFile("testdata/sample.ods")
	if err != nil {
		fmt.Println(err)
		return
	}
	r, err := calcdata.New(ods, "")
	if err != nil {
		fmt.Println(err)
		return
	}
	rc := csvdata.NewRows(r, true)
	defer rc.Close() //dummy

	if err := rc.Next(); err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(rc.Column("name"))
	// Output:
	// Mercury
}

Modules Requirement Graph

dependency.png

# Packages

No description provided by the author
No description provided by the author

# Functions

New function creates a new Reader instance.
No description provided by the author
OpenFile returns CSV file Reader.

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

Reader is class of CSV reader.
Rows is a accesser for row-column data set.

# Interfaces

RowsReader is interface type for reading columns in a row.