const { CellsApi, UploadFileRequest, CellsWorkbook_DeleteUnprotectDocumentRequest,WorkbookProtectionRequest } = 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_DeleteUnprotectDocumentRequest(); req.name = filename; const protection = new WorkbookProtectionRequest(); protection.password = "123"; protection.protectionType = "All"; req.protection = protection; req.folder = "Temp"; cellsApi.cellsWorkbookDeleteUnprotectDocument(req) .then((result) => { console.log("successful") }).catch((error) => { console.error('Unhandled Promise Rejection:', error); }) })