Aspose.Cells Cloud SDK for Go
Go API to Create & Convert Excel Spreadsheets
Create, Read, Modify, Manipulate, Print, Parse, Split, Merge & Convert Excel Spreadsheet Documents in the cloud using Go Excel library.
What is Aspose.Cells Cloud SDK for Go?
Aspose.Cells Cloud SDK for Go is a strong tool for developers. It lets you handle Excel files in the cloud with ease. What makes it great is that it’s cloud-based. This means you can reach your Excel files from anywhere, using any device. No need to install software or stress about compatibility. Everything is securely managed in the cloud, giving you peace of mind. The SDK can be used to develop software applications for a wide range of operating systems, such as Windows, Linux, Mac OS, and many others.
The Aspose.Cells Cloud SDK for Go is packed with a range of useful features that can make life easier for software developers like you when dealing with Excel tasks. It can handle complex calculations, cell formatting, chart additions, and more. You will find it simple to use, and it supports various popular Microsoft Excel file formats like XLS, XLSX, XLSB, and many others. Using Aspose.Cells Cloud SDK software developers can protect their Excel files with a password as well as unprotect files that have been password protected.
The Aspose.Cells Cloud SDK for Go is user-friendly and packed with useful features. It empowers developers to work with Microsoft Excel files effortlessly. With this SDK, you can do a lot of tasks like applying auto filters, handling pivot tables, managing conditional formatting, converting tables to cell ranges, editing rows and cells, searching and replacing text in worksheets, setting backgrounds, adding shapes, inserting pivot tables, hide rows on an Excel worksheet, auto-fit columns on the workbook so on. Overall, it’s a handy tool for Excel manipulation.
Getting Started with Aspose.Cells Cloud SDK for Go
The recommend way to install Aspose.Cells Cloud SDK for Go is using GitHub. Please use the following command for a smooth installation.
Install Aspose.Cells Cloud SDK for Go via GitHub
go get -u github.com/aspose-cells-cloud/aspose-cells-cloud-go/cellsapi
You can also download it directly from Aspose product release page.Protect Excel File via Go API
Aspose.Cells Cloud Go SDK has included a very useful feature allows software developers to protect Excel Spreadsheet from unauthorized access inside their own Go applications. The library has included various features to protecting Excel spreadsheets, such as add digital signature for Excel workbook, protect Excel files without using storage, encrypt Excel workbooks, decrypt Excel workbooks, unprotect Excel workbooks, unlock Excel files without using storage and so on. The following example shows how software developers can add digital signature to their Excel workbook inside Go applications.
How to Add Digital Signature for Excel Workbook via GO?
package main
import (
"os"
asposecellscloud "github.com/aspose-cells-cloud/aspose-cells-cloud-go/v22"
)
func main() {
instance := asposecellscloud.NewCellsApiService(os.Getenv("ProductClientId"), os.Getenv("ProductClientSecret"))
uploadOpts := new(asposecellscloud.UploadFileOpts)
uploadOpts.Path = "roywang.pfx"
file, err := os.Open("roywang.pfx")
if err != nil {
return
}
_, _, err = instance.UploadFile(file, uploadOpts)
if err != nil {
return
}
requestOpts := new(asposecellscloud.CellsWorkbookPostDigitalSignatureOpts)
requestOpts.Digitalsignaturefile = "roywang.pfx"
requestOpts.Folder = "CellsTests"
requestOpts.Name = "Book1.xlsx"
requestOpts.Password = "123456"
_, _, err = instance.CellsWorkbookPostDigitalSignature(requestOpts)
if err != nil {
return
}
}
Export Excel Workbook & Internal Objects via Go API
Aspose.Cells Cloud Go SDK has included very powerful features for exporting an Excel workbook and its internal objects to other supported file formats inside Go applications. It allows exporting workbook, list-object, chart, shape, picture and many other objects from excel file to a specific format, such as PDF, OTS, XPS, DIF, PNG, JPEG, BMP, SVG, TIFF, EMF, NUMBERS, FODS and so on. The following examples demonstrates how to export the Excel workbook to PDF format using Go commands.
How to Export the Excel workbook to PDF format via Go API?
outputFile := "Book1.pdf"
pdfSaveOptions := &models.PdfSaveOptions{
OnePagePerSheet: true,
Quality: "Print",
SecurityOptions: &models.PdfSecurityOptions{
// set PDF security options if needed
},
}
exportRequest := &cellsapi.PostWorkbookSaveAsRequest{
Name: "Book1.xlsx",
Newfilename: outputFile,
SaveOptions: pdfSaveOptions,
Folder: "input",
Format: "pdf",
}
_, _, err = cellsApi.PostWorkbookSaveAs(context.Background(), exportRequest)
if err != nil {
fmt.Println("Error:", err)
return
}
Create & Manage Excel Workbook via Go API
Aspose.Cells Cloud Go SDK enables software developers to create and modify Excel workbook without using Microsoft Office Excel or any other application. The library has included various features for working with Excel worksheets, such as generate an empty Excel workbook, Excel workbook creation from a template file, add new worksheet to existing workbook, rename worksheet, insert chart to existing workbook, generate Excel workbook from a smart marker template and many more.
How to Create a new Excel workbook via Go API?
ctx := context.Background()
request := &models.PutWorkbookCreateRequest{
Name: "MyWorkbook.xlsx",
}
response, _, err := cellsApi.PutWorkbookCreate(ctx, request)
if err != nil {
fmt.Println("Error creating workbook:", err)
return
}
fmt.Println("Workbook created successfully:", response.Status)
Create & Manage Rows/Column via Go API
Aspose.Cells Cloud Go SDK makes it easy for software developers to work with Excel worksheets rows and columns using Go commands. The library supports adding empty rows or columns on an Excel worksheet, deleting selected rows or columns from worksheet, copying rows or columns on worksheet, hiding rows or columns on an Excel worksheet, auto-fit rows or columns on an Excel workbook, grouping rows or columns on an Excel Worksheet and many more.
How to Copy a Row from One Location to Another in a Worksheet using Go SDK?
package main
import (
"fmt"
"os"
"github.com/aspose-cells-cloud/aspose-cells-cloud-go/v21.9/api"
"github.com/aspose-cells-cloud/aspose-cells-cloud-go/v21.9/model"
"github.com/aspose-cells-cloud/aspose-cells-cloud-go/v21.9/api/cellsapi"
)
func main() {
// Set up authentication and initialization
configuration := cellsapi.NewConfiguration()
configuration.AppKey = "your_app_key"
configuration.AppSid = "your_app_sid"
cellsAPI := api.NewCellsApiWithConfig(configuration)
// Copy the row from source location to destination location
sourceWorksheet := "Sheet1"
sourceRowIndex := int32(1)
destinationRowIndex := int32(2)
copyOptions := &model.CopyOptions{
ColumnNumber: nil,
DestinationWorksheet: nil,
Range: "",
RowNumber: &destinationRowIndex,
Worksheet: &sourceWorksheet,
}
_, err := cellsAPI.PostWorksheetRows(context.Background(), "test.xlsx", sourceWorksheet, sourceRowIndex, 1, copyOptions)
if err != nil {
fmt.Println("Error: ", err)
os.Exit(1)
}
fmt.Println("Row copied successfully")
}