21
0
Pure Golang xls library -- forked from https://github.com/extrame/xls
Go to file
Lucas Liu 316372e683 Merge pull request #3 from tgulacsi/date
Expand format recognition for dates
2015-11-26 21:40:46 +08:00
bof.go clean code and add some comments 2015-09-30 10:40:01 +08:00
cell_range.go clean code and add some comments 2015-09-30 10:40:01 +08:00
col.go Expand format recognition for dates 2015-11-25 14:50:29 +01:00
date.go add one example 2015-09-30 11:17:25 +08:00
doc.go add some example 2015-09-30 11:44:14 +08:00
example_test.go add some example 2015-09-30 11:44:14 +08:00
font.go init 2015-03-19 17:39:41 +08:00
format.go partly support time cell 2015-03-25 14:47:26 +08:00
LICENSE add LICENSE and some annotation 2015-06-16 10:37:11 +08:00
README.md add contact info 2015-10-15 11:53:09 +08:00
row.go clean code and add some comments 2015-09-30 10:40:01 +08:00
sst.go init 2015-03-19 17:39:41 +08:00
Table.xls add one example 2015-09-30 11:17:25 +08:00
workbook.go Expand format recognition for dates 2015-11-25 14:50:29 +01:00
worksheet.go remove unnecessary log output 2015-10-30 16:03:44 +08:00
xf.go partly support time cell 2015-03-25 14:47:26 +08:00
xls_test.go add some example 2015-09-30 11:44:14 +08:00
xls.go add one example 2015-09-30 11:17:25 +08:00

xls

GoDoc

Pure Golang xls library writen by MinkTech(chinese)

English User please mailto Liu Ming

This is a xls library writen in pure Golang. Almostly it is translated from the libxls library in c.

It has just the reading function without the format.

Basic Usage

  • Use Open function for open file
  • Use OpenReader function for open xls from a reader

These methods will open a workbook object for reading, like

func (w *WorkBook) ReadAllCells() (res [][]string) {
	for _, sheet := range w.Sheets {
		w.PrepareSheet(sheet)
		if sheet.MaxRow != 0 {
			temp := make([][]string, sheet.MaxRow+1)
			for k, row := range sheet.Rows {
				data := make([]string, 0)
				if len(row.Cols) > 0 {
					for _, col := range row.Cols {
						if uint16(len(data)) <= col.LastCol() {
							data = append(data, make([]string, col.LastCol()-uint16(len(data))+1)...)
						}
						str := col.String(w)
						for i := uint16(0); i < col.LastCol()-col.FirstCol()+1; i++ {
							data[col.FirstCol()+i] = str[i]
						}
					}
					temp[k] = data
				}
			}
			res = append(res, temp...)
		}
	}
	return
}