Ruby API to protect cloud Microsoft Excel and OpenOffice Calc spreadsheet with password
Ruby library to protect cloud Microsoft Excel and OpenOffice Calc spreadsheet with password
Protect cloud Microsoft Excel and OpenOffice Calc spreadsheet with password - Ruby 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 Ruby SDK while maintaining the source spreadsheet's main structural and logical content. Our Ruby library is a professional solution to protect cloud spreadsheets with a password online. This Cloud SDK gives Ruby developers powerful functionality and perfect API.
Ruby 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
# For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-ruby | |
require 'aspose_cells_cloud' | |
class Document | |
include AsposeCellsCloud | |
def initialize | |
#Get client_id and client_secret from https://cloud.aspose.com | |
@instance = AsposeCellsCloud::CellsApi.new($client_id,$client_secret,$api_version,$baseurl) | |
end | |
# Encrypt document. | |
def encrypt_document | |
name = $BOOK1 | |
encryption = AsposeCellsCloud::WorkbookEncryptionRequest.new({:Password=>'123456',:KeyLength=>128,:EncryptionType=>'XOR'}) | |
folder = $TEMPFOLDER | |
result = @instance.upload_file( folder+"/"+name, ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) }) | |
expect(result.uploaded.size).to be > 0 | |
result =@instance.cells_workbook_post_encrypt_document(name, {:encryption=>encryption, :folder=>folder}) | |
expect(result.code).to eql(200) | |
end | |
end | |
document = Document.new() | |
puts document.encrypt_document |
How to use Ruby 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 cells_workbook_post_encrypt_document method to get the resultant stream
System Requirements
- ruby 2.5 or newer