Introduction | simple-excel-go | Spatie       

 SPATIE  

simple-excel-go
===============

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Simple-excel-go](https://spatie.be/docs/simple-excel-go/v1)  Introduction

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/simple-excel-go/v1) 

  Introduction    
- [ Introduction ](https://spatie.be/docs/simple-excel-go/v1/introduction)
- [ Installation and setup ](https://spatie.be/docs/simple-excel-go/v1/installation-and-setup)
- [ Reading files ](https://spatie.be/docs/simple-excel-go/v1/reading-files)
- [ Writing files ](https://spatie.be/docs/simple-excel-go/v1/writing-files)
- [ Testing ](https://spatie.be/docs/simple-excel-go/v1/testing)
- [ Releasing ](https://spatie.be/docs/simple-excel-go/v1/releasing)
- [ Changelog ](https://spatie.be/docs/simple-excel-go/v1/changelog)
- [ Support us ](https://spatie.be/docs/simple-excel-go/v1/support-us)

  Simple-excel-go 
=================

 Read and write simple Excel and CSV files in Go 

### Useful links

- [Repository](https://github.com/spatie/simple-excel-go)
- [Discussions](https://github.com/spatie/simple-excel-go/discussions)

Introduction
------------

This package allows you to easily read and write simple Excel, CSV and ODS files.

Here's an example on how to read an Excel or CSV file:

```
func printEmails(ctx context.Context) error {
    reader, err := simpleexcel.NewReader("people.csv")
    if err != nil {
        return err
    }
    for row, err := range reader.Rows(ctx) {
        if err != nil {
            return err
        }
        email, _ := row.Get("email")
        fmt.Println(email)
    }
    return nil
}
```

Import `context`, `fmt` and `github.com/spatie/simple-excel-go`.

If the path ends with `.csv`, a CSV file is assumed. `.xlsx` selects Excel and `.ods` selects OpenDocument Spreadsheet. Use `ReaderOptions.Format` or `WriterOptions.Format` to override the extension.

Behind the scenes Go iterators are used, so you can process rows without collecting the entire file. CSV and ODS read records incrementally. XLSX reads retain worksheet data and shared strings in memory.

Start with [installation and setup](installation-and-setup), then read [reading files](reading-files) and [writing files](writing-files).

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
