Documentation
¶
Overview ¶
Package xlsx provides a pure-Go reader and writer for Office Open XML spreadsheet files (.xlsx, .xlsm, .xltx, .xltm).
Index ¶
- type File
- func (x *File) AddPicture(_, _, _ string, _ *xmltypes.GraphicOptions) error
- func (x *File) AutoFilter(_, _, _ string) error
- func (x *File) Close() error
- func (x *File) DeleteSheet(name string) error
- func (x *File) DuplicateSheet(from, _ int) error
- func (x *File) FreezePane(_, _ string, _, _ int) error
- func (x *File) GetCellFormula(sheet, axis string) (string, error)
- func (x *File) GetCellValue(sheet, axis string) (string, error)
- func (x *File) GetCols(sheet string) ([][]string, error)
- func (x *File) GetRows(sheet string) ([][]string, error)
- func (x *File) GetSheetIndex(name string) (int, error)
- func (x *File) GetSheetList() ([]string, error)
- func (x *File) GetSheetName(index int) (string, error)
- func (x *File) GetWorkBookStructure() *xmltypes.WorkBookEntity
- func (x *File) InsertCols(sheet, col string, n int) error
- func (x *File) InsertRows(sheet string, row int) error
- func (x *File) MergeCell(sheet, hCell, vCell string) error
- func (x *File) NewSheet(name string) (int, error)
- func (x *File) NewStreamWriter(sheet string) (*StreamWriter, error)
- func (x *File) NewStyle(_ *xmltypes.StyleConfig) (int, error)
- func (x *File) ProtectSheet(_ string, _ *xmltypes.SheetProtection) error
- func (x *File) RemoveCol(sheet, col string) error
- func (x *File) RemoveRow(sheet string, row int) error
- func (x *File) Rows(sheet string) (*Rows, error)
- func (x *File) Save(filename string) error
- func (x *File) SetCellFormula(sheet, axis, formula string) error
- func (x *File) SetCellStyle(sheet, hCell, _ string, styleID int) error
- func (x *File) SetCellValue(sheet, axis string, value any) error
- func (x *File) SetDocProps(_ *xmltypes.DocProps) error
- func (x *File) SetSheetName(oldName, newName string) error
- func (x *File) UnmergeCell(sheet, hCell string) error
- func (x *File) UnprotectSheet(_, _ string) error
- type Rows
- type StreamWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File holds the internal structure for XLSX files.
func NewFile ¶
func NewFile() *File
NewFile creates a new XLSX file structure with one default sheet.
func OpenReader ¶
OpenReader opens an existing XLSX file from an io.Reader.
func (*File) AddPicture ¶
func (x *File) AddPicture(_, _, _ string, _ *xmltypes.GraphicOptions) error
AddPicture embeds a picture into a sheet.
func (*File) AutoFilter ¶
AutoFilter sets auto filter for the given range.
func (*File) DeleteSheet ¶
DeleteSheet deletes the sheet with the given name.
func (*File) DuplicateSheet ¶
DuplicateSheet duplicates the sheet at the given index.
func (*File) FreezePane ¶
FreezePane creates a freeze pane at the given row/col position.
func (*File) GetCellFormula ¶
GetCellFormula returns the formula stored in a cell.
func (*File) GetCellValue ¶
GetCellValue retrieves the value of a cell in an XLSX file.
func (*File) GetSheetIndex ¶
GetSheetIndex returns the index of the sheet with the given name.
func (*File) GetSheetList ¶
GetSheetList returns the list of sheet names.
func (*File) GetSheetName ¶
GetSheetName returns the name of the sheet at the given index.
func (*File) GetWorkBookStructure ¶
func (x *File) GetWorkBookStructure() *xmltypes.WorkBookEntity
GetWorkBookStructure returns the exposed workbook structure for compatibility.
func (*File) InsertCols ¶
InsertCols inserts n columns at the given column position.
func (*File) InsertRows ¶
InsertRows inserts n empty rows after the given 1-based row position.
func (*File) NewStreamWriter ¶
func (x *File) NewStreamWriter(sheet string) (*StreamWriter, error)
NewStreamWriter returns a streaming writer for large datasets.
func (*File) NewStyle ¶
func (x *File) NewStyle(_ *xmltypes.StyleConfig) (int, error)
NewStyle creates a new style and returns its index.
func (*File) ProtectSheet ¶
func (x *File) ProtectSheet(_ string, _ *xmltypes.SheetProtection) error
ProtectSheet applies password protection to a sheet.
func (*File) SetCellFormula ¶
SetCellFormula sets the formula of a cell.
func (*File) SetCellStyle ¶
SetCellStyle sets the style index for a cell.
func (*File) SetCellValue ¶
SetCellValue sets the value of a cell in an XLSX file.
func (*File) SetDocProps ¶
SetDocProps sets document properties (no-op placeholder).
func (*File) SetSheetName ¶
SetSheetName renames a worksheet.
func (*File) UnmergeCell ¶
UnmergeCell removes a merge from a range of cells.
func (*File) UnprotectSheet ¶
UnprotectSheet removes protection from a sheet.
type Rows ¶
type Rows struct {
// contains filtered or unexported fields
}
Rows defines the stream reader for the rows in a XLSX worksheet.
type StreamWriter ¶
type StreamWriter struct {
// contains filtered or unexported fields
}
StreamWriter defines the stream writer for the rows in a XLSX worksheet.
func (*StreamWriter) Flush ¶
func (sw *StreamWriter) Flush() error
Flush finalizes any pending writes (no-op for in-memory writer).