In a digital-first world, securing documents is essential because it contains sensitive user data of business critical information. When dealing with Excel files that contain sensitive or verified data, adding a digital signature helps ensure authenticity and prevents tampering. With GroupDocs.Signature Cloud SDK for Node.js, you can automate this process and sign .xls or .xlsx files online using a REST API — no desktop software or manual processing required.

Excel Digital Signature API for Node.js

Aspose.Cells Cloud SDK for Node.js is an amazing REST based API that simplifies Excel document automation and supports digital signatures via PFX certificates. This cloud-based API enables you to programmatically manage Excel workbooks through a wide range of operations:

  • Create, open, and edit Excel files (.xls, .xlsx)
  • Apply password protection and encryption
  • Extract data, text, images, charts, and more from existing Excel files
  • Import/export JSON and XML to/from worksheets, and much more.

🔑 Prerequisites

  1. Create a free account at Aspose.Cloud Dashboard
  2. Obtain your Client ID and Client Secret
  3. Install the SDK:
npm install asposecellscloud

How to Sign Excel Files in Node.js

In this section, we are going to explore the details on how we can add digital signature to Excel workbook using Node.js API.

Step 1: Set up SDK Configuration:

const { CellsApi, Configuration } = require("asposecellscloud");
// provide your client credentials are arguments
const config = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");
const cellsApi = new CellsApi(config);

Step 2: Upload Excel and Certificate Files: Use SDK or REST API to upload sample.xlsx and certificate.pfx to cloud storage.

cellsApi.uploadFile() // use this method for both Excel and PFX certificate.

Step 3: Create a Digital Signature:

let digitalSignRequest = {
  name: "sample.xlsx",
  digitalSignRequest: {
    password: "yourPfxPassword",
    digitalSignature: {
      certificatePath: "certificate.pfx",
      comments: "Signed by Nayyer Shahbaz",
      location: "Cloud",
      authority: "Aspose Authority"
    }
  }
};

// add digital signature to Excel workbook
cellsApi.cellsWorkbookPostDigitalSignature(digitalSignRequest).then(result => {
  console.log("Excel signed successfully:", result);
}).catch(error => {
  console.error("Error signing Excel:", error);
});

Sign XLSX via cURL Commands

The Aspose.Cells Cloud REST API offers full control over digital signing directly via cURL, making it ideal for automation scripts, DevOps pipelines, or environments where SDKs are not preferred.

Given below are the steps on how to use the cURL commands to sign Excel files online:

Step 1: Get Access Token:

curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=XXXXXX-XXXX-XXXXX-XXXX&client_secret=CLIENT_SECRET" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Step 2: Upload Excel File and Certificate to Cloud Storage: Before signing, we need to upload the Excel workbook and digital certificate to Aspose Cloud storage:

curl -v -X PUT "https://api.aspose.cloud/v3.0/cells/storage/file/sample.xlsx" \
     -F file=@"sample.xlsx" \
     -H "Authorization: Bearer ACCESS_TOKEN"

curl -v -X PUT "https://api.aspose.cloud/v3.0/cells/storage/file/certificate.pfx" \
     -F file=@"certificate.pfx" \
     -H "Authorization: Bearer ACCESS_TOKEN"

Step 3: Digitally Sign the Excel Workbook: Now send a POST request to apply the digital signature:

curl -v "https://api.aspose.cloud/v3.0/cells/{excelName}/digitalsignature?digitalsignaturefile={DigitalSignature}&password=test1234" \
-X POST \
-H  "accept: application/json" \
-H  "authorization: Bearer {ACCESS_TOKEN}"

Replace {excelName} with the name of the Excel file, {DigitalSignature} with name of digital certificate from cloud storage and, {ACCESS_TOKEN} with the access token generated above.

🌐 Try Free Online Excel Signature App

Explore our Free Online Excel Signer App to test functionality before implementation.

Free excel signature app

Concluding Remarks

Using Aspose.Cells Cloud SDK for Node.js, you can digitally sign Excel workbooks in a secure and automated way. Whether you’re developing document workflows, validating content authenticity, or building compliance tools — this API lets you integrate robust signing capabilities into your apps effortlessly.

📚 Additional Resources

FAQs

  1. Does Aspose.Cells Cloud support password-protected Excel files?
  • Yes. Provide the password as part of the request body.
  1. What signature format is supported?
  • PFX-based certificate digital signatures are supported.
  1. Can I verify the digital signature after signing?
  • Yes. You can use the verification APIs provided by Aspose.Cells Cloud.

You may consider visiting the following links to learn more about: