Aspose.Cells Cloud SDK for Go
The SDK is open-source and licensed under the MIT License. You can access the Go library source code for Aspose.Cells Cloud here.
How to use Go library of Aspose.Cells Cloud
Aspose.Cells Cloud SDK for Go is a powerful library that allows developers to manipulate and process Microsoft Excel files using the Go programming language. With this SDK, you can create, edit, and convert Excel documents in the cloud, without installing additional software or dependencies on your local machine.
In this article, we’ll explore how to use Aspose.Cells Cloud SDK for Go to perform some common tasks, such as creating a new Excel workbook, inserting data into cells, and saving the modified workbook to the cloud.
Getting Started
Before you can start using the Aspose.Cells Cloud SDK for Go, you need to set up your development environment and install the necessary dependencies. Refer to the article on the Aspose website to obtain your client ID and client secret.
How to install the Go package for Aspose.Cells Cloud
You can install Aspose.Cells Cloud SDK for Go using the go get
command. Open your terminal or command prompt and run the following command:
go install github.com/aspose-cells-cloud/aspose-cells-cloud-go@latest
This will download and install the latest version of the SDK to your Go workspace.
How to import Go library into your project
package main
import (
. "github.com/aspose-cells-cloud/aspose-cells-cloud-go/v25"
)
How to get started with Aspose.Cells Cloud for Go, follow these steps
- Create an account at Aspose for Cloud and obtain your application client id and secret.
- Create a directory for your project and a main.go file within. Add the following code to your main.go.
Sample Code
package main | |
import ( | |
"os" | |
. "github.com/aspose-cells-cloud/aspose-cells-cloud-go/v25" | |
) | |
func main() { | |
println("Hello Aspose.Cells Cloud!") | |
CellsCloudClientId := "...." // get from https://dashboard.aspose.cloud/#/applications | |
CellsCloudClientSecret := "...." // get from https://dashboard.aspose.cloud/#/applications | |
instance := NewCellsApiService(CellsCloudClientId, CellsCloudClientSecret) | |
request := PutConvertWorkbookRequest{File: map[string]string{"Book1.xlsx": "TestData/Book1.xlsx"}, Format: "pdf"} | |
data, _, err := instance.PutConvertWorkbook(&request) | |
if err == nil { | |
file, _ := os.OpenFile("Book1.pdf", os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644) | |
file.Write(data) | |
defer file.Close() | |
} | |
} |
- Initialize project go.mod , fetch the dependencies for your project, and run your created application.
go mod init main
go mod tidy
go run main.go