excel

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package excel provides Excel import and export for the pulse I/O pipeline.

Package excel provides Excel import and export for the pulse I/O pipeline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*config)

Option configures Excel reader or writer behavior.

func WithSheet

func WithSheet(name string) Option

WithSheet selects a named sheet to read from or write to.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader reads tabular data from an Excel (.xlsx) file.

func NewReader

func NewReader(fs afero.Fs, path string, opts ...Option) *Reader

NewReader creates an Excel reader from a filesystem path.

func NewReaderFromBytes

func NewReaderFromBytes(data []byte, opts ...Option) *Reader

NewReaderFromBytes creates an Excel reader from raw bytes.

func (*Reader) Close

func (r *Reader) Close() error

Close releases resources.

func (*Reader) ReadHeader

func (r *Reader) ReadHeader() ([]string, error)

ReadHeader returns the column names from the first row.

func (*Reader) ReadRows

func (r *Reader) ReadRows(ctx context.Context, fn func(row []string) error) error

ReadRows streams rows to fn. ReadHeader must be called first.

func (*Reader) Reset

func (r *Reader) Reset() error

Reset rewinds the reader to the beginning.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer writes tabular data to an Excel (.xlsx) file.

func NewWriter

func NewWriter(fs afero.Fs, path string, opts ...Option) *Writer

NewWriter creates an Excel writer targeting a filesystem path.

func (*Writer) Close

func (w *Writer) Close() error

Close flushes and writes the workbook to the target path.

func (*Writer) SetPulseSchema added in v0.2.0

func (w *Writer) SetPulseSchema(s *encoding.Schema)

SetPulseSchema records the source .pulse schema. Implements pio.SchemaAwareWriter so ExportJob can hand the writer typed values for decimal128 columns.

func (*Writer) WriteHeader

func (w *Writer) WriteHeader(columns []string) error

WriteHeader writes column names as the first row.

func (*Writer) WriteRow

func (w *Writer) WriteRow(values []any) error

WriteRow writes a single data row. With a Pulse schema set the writer renders decimal128 cells as Excel numbers with a scale-driven "0.000…" format. Without a schema, values pass through excelize's default cell-value handling.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL