NodeJS API to decrypt cloud Microsoft Excel and OpenOffice Calc spreadsheet with password
NodeJS library to decrypt cloud Microsoft Excel and OpenOffice Calc spreadsheet with password
Decrypt cloud Microsoft Excel and OpenOffice Calc spreadsheet with password - NodeJS REST API
API Request:
DELETE
https://api.aspose.cloud/v3.0/cells/{name}/encryption
Decrypting a cloud spreadsheet with a password is a complex task. Decrypting a local spreadsheet with password transitions is performed by our NodeJS SDK while maintaining the source spreadsheet's main structural and logical content. Our NodeJS library is a professional solution to decrypt cloud spreadsheets with a password online. This Cloud SDK gives NodeJS developers powerful functionality and perfect API.
NodeJS code for decrypting cloud spreadsheets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { CellsApi, UploadFileRequest, CellsWorkbook_DeleteDecryptDocumentRequest, WorkbookEncryptionRequest } = require("asposecellscloud"); | |
const clientId = process.env.CellsCloudClientId; | |
const clientSecret = process.env.CellsCloudClientSecret; | |
const ApiURL = process.env.CellsCloudApiBaseUrl; | |
const fs = require('fs'); | |
const path = require('path'); | |
const cellsApi = new CellsApi(clientId, clientSecret,"v3.0",ApiURL); | |
const localPath = "D:/aspose-cells-cloud-node/TestData/" | |
const filename = "Book1.xlsx"; | |
const data =fs.createReadStream(path.join(localPath, filename)); | |
const req = new UploadFileRequest({ | |
path: "Temp/" + filename, | |
file: data | |
}); | |
cellsApi.uploadFile(req) | |
.then((result) => { | |
const req = new CellsWorkbook_DeleteDecryptDocumentRequest(); | |
req.name = filename; | |
const encryption = new WorkbookEncryptionRequest(); | |
encryption.password = "123456"; | |
encryption.keyLength = 128; | |
encryption.encryptionType = "XOR"; | |
req.encryption = encryption; | |
req.folder = "Temp"; | |
cellsApi.cellsWorkbookDeleteDecryptDocument(req) | |
.then((result) => { | |
console.log("successful") | |
}).catch((error) => { | |
console.error('Unhandled Promise Rejection:', error); | |
}) | |
}) |
How to use Node API to decrypt
- Create an account at Dashboard to get free API quota & authorization details
- Initialize CellsApi with Client Id, Client Secret, Base URL & API version
- Call cellsWorkbookDeleteDecryptDocument method to get the resultant stream
System Requirements
- node v6.17.1 or newer