kmgExcel

package
v0.0.0-...-05317bf Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2015 License: MIT Imports: 12 Imported by: 0

README

kmgExcel

A easy interface for excel file reading

  • Unmarshal excel into a array of a struct
  • Unmarshal excel into [][][]string
  • Unmarshal a sheet of a excel into [][]string

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Array2XlsxByte

func Array2XlsxByte(data [][]string) (b []byte, err error)

func Array2XlsxFile

func Array2XlsxFile(data [][]string, path string) (err error)

write raw data into xlsx file data key means: rowIndex,columnIndex,value

func Array2XlsxIo

func Array2XlsxIo(data [][]string, w io.Writer) (err error)

write raw data into a io.Writer data key means: rowIndex,columnIndex,value Array2XlsxIo can be used to write xlsx file in memory without touch filesystem.

func CoordinateXy2Excel

func CoordinateXy2Excel(collomnIndex int, rowIndex int) (output string)

坐标系变换,从xy坐标系变化成excel的字符坐标系 xy坐标从(0,0)开始,excel坐标从A1开始

func GridToTitleArrayWithTitle

func GridToTitleArrayWithTitle(grid []map[string]string, title []string) (titleArray [][]string, err error)

transform from grid to title array keys not in title will return an error key in title but not in element map ,value will be "" in titleArray len(grid)==0 will return a titleArray only have title in it.

func TitleArraySortByFirst

func TitleArraySortByFirst(titleArray [][]string)

func TitleArrayToGrid

func TitleArrayToGrid(titleArray [][]string) (output []map[string]string, err error)

transform from title array to grid titleArray should call Trim2DArray already

func Trim2DArray

func Trim2DArray(input [][]string) (output [][]string)

remove empty cell right(every line will have same length) remove all empty line (include some empty line in between)

func TrimRightRowString

func TrimRightRowString(row []string) []string

func UnmarshalFile

func UnmarshalFile(filePath string, obj interface{}) (err error)

Unmarshal excel into a array of a struct

you must put data in first sheet accept []struct{Key1 value;Key2 value} or []map[string]string first excel row as struct key,remain excel row as struct value type can not convert will fail lack keys will be ignore

func UnmarshalFileSkipLine

func UnmarshalFileSkipLine(filePath string, obj interface{}, skipline int) (err error)

Unmarshal excel into a array of a struct and skip some line from start

func XlsxFile2Array

func XlsxFile2Array(path string) ([][][]string, error)

get all raw data from excel output index mean=> sheetIndex ,row ,cell ,value not remove any cells

func XlsxFileFirstSheet2ArrayTrim

func XlsxFileFirstSheet2ArrayTrim(path string) (output [][]string, err error)

get data from first sheet of excel output index mean=> row ,cell ,value remove all right and bottom blank cells

func XlsxFileFirstSheet2FirstColumnTrim

func XlsxFileFirstSheet2FirstColumnTrim(path string) (output []string, err error)

get data from first column of first sheet of excel file output index name=>row index,value remove any blank cells. output will not include blank cell in middle.

func XlsxFileSheetIndex2Array

func XlsxFileSheetIndex2Array(path string, index int) ([][]string, error)

get raw data from one sheet of excel output index mean=> row ,cell ,value not remove any cells

Types

This section is empty.

Jump to

Keyboard shortcuts

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