Managing Excel spreadsheets through programming becomes simpler with the GroupDocs.Editor Cloud .NET SDK. Developers can efficiently edit Excel documents in .NET without relying on Microsoft Excel or external software. This cloud-based API offers a safe and effective method for automatically processing Excel files while automating data entry, updating formulas, or changing spreadsheet formats.
With only a few API calls, you can load, modify, and save Excel spreadsheets in various formats while maintaining data integrity. The SDK allows for updates to cell values, modifications to tables, and more, making it a perfect option for large-scale applications and cloud-based data processing tasks.
Seamlessly integrate Excel workbook editing into your cross-platform C#, VB.NET, and ASP.NET applications to enhance productivity with flexible and scalable cloud API functionalities. Begin automating your spreadsheet processes today by exploring this comprehensive tutorial and discover a quicker, more dependable way to manage Excel documents programmatically in .NET.
The C# code example provided below will enable you to test the feature and integrate it into your .NET applications immediately.
using System.Text;
using GroupDocs.Editor.Cloud.Sdk;
using GroupDocs.Editor.Cloud.Sdk.Api;
using GroupDocs.Editor.Cloud.Sdk.Client;
using GroupDocs.Editor.Cloud.Sdk.Model;
using GroupDocs.Editor.Cloud.Sdk.Model.Requests;
class Program
{
static void Main()
{
// Set up API credentials
string MyAppKey = "your-app-key";
string MyAppSid = "your-app-sid";
var configuration = new Configuration(MyAppKey, MyAppSid);
// Define file paths
string inputFilePath = "SampleFiles/input.xlsx";
string outputFilePath = "editor/edited.xlsx";
// Initialize the editor and file API instances
var editorApi = new EditApi(configuration);
var fileApi = new FileApi(configuration);
// Load the spreadsheet into editable state
var loadOptions = new SpreadsheetLoadOptions
{
FileInfo = new GroupDocs.Editor.Cloud.Sdk.Model.FileInfo
{
FilePath = inputFilePath,
},
OutputPath = "editor",
WorksheetIndex = 1 // select the workbook to edit
};
var loadResult = editorApi.Load(new LoadRequest(loadOptions));
// Download HTML representation
using var stream = fileApi.DownloadFile(
new DownloadFileRequest(loadResult.HtmlPath));
string htmlContent = new StreamReader(stream, Encoding.UTF8).ReadToEnd();
// Perform text editing in the spreadsheet
htmlContent = htmlContent.Replace("Edit Workbooks in C#", "Hello World");
// Upload modified HTML back to storage
fileApi.UploadFile(new UploadFileRequest(
loadResult.HtmlPath,
new MemoryStream(Encoding.UTF8.GetBytes(htmlContent))));
// Save changes back to the original format
var saveOptions = new SpreadsheetSaveOptions
{
FileInfo = loadOptions.FileInfo,
OutputPath = outputFilePath,
HtmlPath = loadResult.HtmlPath,
ResourcesPath = loadResult.ResourcesPath
};
editorApi.Save(new SaveRequest(saveOptions));
}
}
Top comments (0)