Simple Spreadsheet

This guide will show how to create a simple spreadsheet using UniOffice.

Before you begin

You should get your API key from your UniCloud account.

If this is your first time using UniOffice SDK, follow this guide to set up a local development environment.

Clone the project repository

In your terminal, clone the examples repository. It contains the Go code we will be using for this guide.

git clone https://github.com/unidoc/unioffice-examples

To get the example navigate to the path spreadsheet/simple folder in the unioffice-examples directory.

cd unioffice-examples/spreadsheet/simple/

How it works

The import section in lines 4-11 imports the necessary libraries from UniOffice and the Go standard library. The init function defined in lines 13-20 initializes the package by setting the metered license key.

The main function starts in line 22. Then a new workbook with an empty spreadsheet is created in lines 23-26. The nested for loops in lines 29-36 creates a table with each cell containing its row and cell number. Then in lines 38-42, the workbook is validated and saved to file.

Run the code

Use the following command to run the code.

go run main.go

Sample Output

Simple spreadsheet

Got any Questions?

We're here to help you.