Skip to content

Instantly share code, notes, and snippets.

@blog-aspose-cloud
Last active March 21, 2023 20:49
Show Gist options
  • Save blog-aspose-cloud/8b0fb9bcdd53afc1649b4ad9bed6034a to your computer and use it in GitHub Desktop.
Save blog-aspose-cloud/8b0fb9bcdd53afc1649b4ad9bed6034a to your computer and use it in GitHub Desktop.
Digitally sign Excel worksheet

How to Add a Digital Signature to Excel Files using C# .NET


Learn how to digitally sign Excel files using C# .NET with our step-by-step guide. Discover how to insert an electronic signature, including Excel digital signature and sign on Excel features. Start signing Excel documents securely and efficiently today using Aspose.Cells Cloud SDK for .NET .

For complete information, please visit How to Add a Digital Signature to Excel Files using C# .NET.

digital signature in excel

Important Links

Product Page | Docs | Live Demo | Swagger UI | Code Samples | Source Code | New Releases | Blog | Free Support | Free Trial

Add digital signature for Excel workbook
// For complete examples and data files, please go to
https://github.com/aspose-cells-cloud/aspose-cells-cloud-dotnet/
// Get client credentials from https://dashboard.aspose.cloud/
string clientSecret = "4d84d5f6584160cbd91dba1fe145db14";
string clientID = "bb959721-5780-4be6-be35-ff5c3a6aa4a2";
// create CellsApi instance while passing ClientID and ClientSecret
CellsApi cellsInstance = new CellsApi(clientID, clientSecret);
// first Excel workbook on drive
string input_Excel = "source.xlsx";
// name of digital certificate
string signature_File = "test1234.pfx";
try
{
// read the Excel file and upload to cloud storage
cellsInstance.UploadFile(input_Excel, File.OpenRead(input_Excel));
// read Digital certificate and upload to cloud storage
cellsInstance.UploadFile(signature_File, File.OpenRead(signature_File));
// initialize the digital sign operation
var response = cellsInstance.CellsWorkbookPostDigitalSignature(input_Excel, signature_File, "test1234");
// print success message if concatenation is successful
if (response != null && response.Equals("OK"))
{
Console.WriteLine("Digital Signature added successfully !");
Console.ReadKey();
}
}
catch (Exception ex)
{
Console.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment