Using Golang to Read and Create Excel files

Tremaine Eto
cloud native: the gathering
5 min readAug 29, 2019

--

You’ve written your Go application, and suddenly you are tasked with creating a button to save the form data to an Excel (a.k.a XLSX) file. Or, rather, you need to read in an Excel file that a user uploads and then populate data on your webpage based on its contents.

This definitely wouldn’t be easy to do on your own. Fortunately, there’s a library for that: Excelize.

And no, I’m not affiliated in any way to Excelize or the group that develops it. I just had a use case recently that necessitated working with Excel files with Go, and Excelize was the quickest (and surprisingly most robust) path to completion. For a quick link to their docs, click here.

What you need

  • Go 1.10 or later
  • Microsoft Excel™ 2007 and later — or another program that can deal with XLSX files so you can test

Set-up

In the root of your Go project, run the following command:

go get github.com/360EntSecGroup-Skylar/excelize/v2

--

--

Tremaine Eto
cloud native: the gathering

Senior Software Engineer @ Iterable | Previously worked at DIRECTV, AT&T, and Tinder | UCLA Computer Science alumni | Follow me for software engineering tips!