NodeJS API to protect cloud Microsoft Excel and OpenOffice Calc spreadsheet with password
NodeJS library to protect cloud Microsoft Excel and OpenOffice Calc spreadsheet with password
Protect cloud Microsoft Excel and OpenOffice Calc spreadsheet with password - NodeJS REST API
API Request:
POST
https://api.aspose.cloud/v3.0/cells/{name}/encryption
Protecting a cloud spreadsheet with a password is a complex task. Protecting a cloud 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 protect cloud spreadsheets with a password online. This Cloud SDK gives NodeJS developers powerful functionality and perfect API.
CPP code for encryption 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_PostEncryptDocumentRequest, 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_PostEncryptDocumentRequest(); | |
req.name = filename; | |
req.folder = "Temp"; | |
const encryption = new WorkbookEncryptionRequest(); | |
encryption.password = "123456"; | |
encryption.keyLength = 128; | |
encryption.encryptionType = "XOR"; | |
req.encryption = encryption; | |
cellsApi.cellsWorkbookPostEncryptDocument(req) | |
.then((result) => { | |
console.log("successful") | |
}).catch((error) => { | |
console.error('Unhandled Promise Rejection:', error); | |
}) | |
}) |
How to use Node API to encrypt
- Create an account at Dashboard to get free API quota & authorization details
- Initialize CellsApi with Client Id, Client Secret, Base URL & API version
- Call cellsWorkbookPostEncryptDocument method to get the resultant stream
System Requirements
- node v6.17.1 or newer