Skip to content
/ xlsx Public

Fast XLSX reader. Doesn't read formats nor styles, only data.

License

Notifications You must be signed in to change notification settings

dgrr/xlsx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xlsx

Go Report Card Build Status codecov

Working with XLSX is most of the times a pain (is built with XML). This package aims to work with XLSX files to extract only the data inside. It doesn't manage styles or any other fancy feature. It supports shared strings (because it's not a fancy feature) and it is fast and easy to use.

package main

import (
	"fmt"
	"log"
	"os"

	"github.com/dgrr/xlsx"
)

func main() {
	// open the XLSX file.
	ws, err := xlsx.Open(os.Args[1])
	if err != nil {
		log.Fatalln(err)
	}
	defer ws.Close() // do not forget to close

	// iterate over the sheets
	for _, wb := range ws.Sheets {
		r, err := wb.Open()
		if err != nil {
			log.Fatalln(err)
		}

		for r.Next() { // get next row
			fmt.Println(r.Row())
		}
		if r.Error() != nil { // error checking
			log.Fatalln(r.Error())
		}
		// don't forget to close the sheet!!
		r.Close()
	}
}

About

Fast XLSX reader. Doesn't read formats nor styles, only data.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages