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

Use Cells Protect REST API to protect cloud Microsoft Excel and OpenOffice Calc spreadsheet with password workflows in Ruby. This professional solution protects cloud Microsoft Excel and OpenOffice Calc spreadsheet online with passwords using Ruby.

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

# 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


  1. Create an account at Dashboard to get free API quota & authorization details
  2. Initialize CellsApi with Client Id, Client Secret, Base URL & API version
  3. Call cells_workbook_post_encrypt_document method to get the resultant stream


System Requirements


  1. ruby 2.5 or newer