excelTools

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseExcel

func CloseExcel(f *excelize.File)

CloseExcel 关闭excel文件

func ExportToExcel

func ExportToExcel[T any](dst io.Writer, data []T) error

ExportToExcel 将结构体切片导出为 Excel

func GetTplSheetFieldIndex

func GetTplSheetFieldIndex(file *excelize.File, model any, fieldRowNum int) (string, map[string]string, error)

GetTplSheetFieldIndex 获取模板字段 读取excel里面指定sheet的数据,并提取某一列的所有字段所在的位置。

func ReadExcelRow

func ReadExcelRow(excelFile *excelize.File, sheetName []string, sheetIndex []int, excludeSheet []string, dataRow int, dataCol int, call func(sheetName string, tmp map[string]any) error, fieldRowNum ...int) error

ReadExcelRow 读取excel 指定或者每个sheet的数据,并通过回调函数方式进行处理 excelFile *excelize.File excel文件 sheetName []string sheet名称集合,如果不填就是读取所有sheet sheetIndex []int sheet索引集合,如果不填就是读取所有sheet,注意,这里需要从0开始 dataRow int 数据行数,从第几行开始读取有效数据 dataCol int 数据列数,保证每行有效数据有多少列 call func(sheetName string,tmp map[string]any) error 回调函数,用于自定义处理每列数据 fieldRowNum ...int 字段行数,默认为第一行, 从1开始。

Types

type HasSheetName

type HasSheetName interface {
	SheetName() string
}

Jump to

Keyboard shortcuts

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