UmyaSpreadsheet.WorkbookFunctions (umya_spreadsheet_ex v0.7.0)

View Source

Functions for manipulating workbook properties and security.

Summary

Functions

Sets password protection for an existing Excel file.

Sets workbook protection with a password.

Functions

set_password(input_path, output_path, password)

Sets password protection for an existing Excel file.

This function adds password protection to an existing file without loading it into memory.

Parameters

  • input_path - Path to the input Excel file
  • output_path - Path where the protected file should be saved
  • password - The password to protect the file with

Returns

  • :ok on success
  • {:error, reason} on failure

Examples

:ok = UmyaSpreadsheet.WorkbookFunctions.set_password("input.xlsx", "protected.xlsx", "password123")

set_workbook_protection(spreadsheet, password)

Sets workbook protection with a password.

Parameters

  • spreadsheet - The spreadsheet struct
  • password - The password to protect the workbook with

Returns

  • :ok on success
  • {:error, reason} on failure

Examples

{:ok, spreadsheet} = UmyaSpreadsheet.read_file("input.xlsx")
:ok = UmyaSpreadsheet.WorkbookFunctions.set_workbook_protection(spreadsheet, "password123")