Swift API to protect cloud Microsoft Excel and OpenOffice Calc spreadsheet with password
Swift library to protect cloud Microsoft Excel and OpenOffice Calc spreadsheet with password
Protect cloud Microsoft Excel and OpenOffice Calc spreadsheet with password - Swift 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 Swift SDK while maintaining the source spreadsheet's main structural and logical content. Our Swift library is a professional solution to protect cloud spreadsheets with a password online. This Cloud SDK gives Swift developers powerful functionality and perfect API.
Swift 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
let expectation1 = self.expectation(description: "checkAuth") | |
AsposeCellsCloudAPI.clientId = "xxx-xxx-xxx-xxx-xxxxx" | |
AsposeCellsCloudAPI.clientSecret = "xxxxxx" | |
AuthAspose.checkAuth() | |
{ | |
(authError) in | |
guard authError == nil else { | |
//XCTFail("error checkAuth") | |
return | |
} | |
expectation1.fulfill() | |
} | |
self.waitForExpectations(timeout: testTimeout, handler: nil) | |
//cellsWorkbookPostEncryptDocument | |
let expectation = self.expectation(description: "testcellsWorkbookPostEncryptDocument") | |
let name:String = BOOK1 | |
let encryption:WorkbookEncryptionRequest? = WorkbookEncryptionRequest(password: "123456", keyLength: 128, encryptionType: "XOR") | |
let folder:String = TEMPFOLDER | |
let storageName:String? = nil | |
uploadFile(name: name) { | |
CellsAPI.cellsWorkbookPostEncryptDocument(name: name, encryption: encryption, folder: folder, storageName: storageName) | |
{ | |
(response, error) in | |
guard error == nil else { | |
XCTFail("error testcellsWorkbookPostEncryptDocument") | |
return | |
} | |
if let response = response { | |
XCTAssertEqual(response.code, 200) | |
expectation.fulfill() | |
} | |
} | |
} | |
self.waitForExpectations(timeout: testTimeout, handler: nil) |
How to use Swift 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
- macOS Monterey 12.4
- Swift 4.2