UmyaSpreadsheet (umya_spreadsheet_ex v0.7.0)

View Source

UmyaSpreadsheet is an Elixir wrapper for the Rust umya-spreadsheet library, which provides Excel (.xlsx, .xlsm) file manipulation capabilities with the performance benefits of Rust.

Overview

This library allows you to:

  • Create new spreadsheets from scratch
  • Read/write Excel files with full formatting support
  • Manipulate cell values, formulas, and styles
  • Move and organize ranges of data
  • Add and manage multiple worksheets
  • Create charts, images, and visual elements
  • Embed OLE objects (Word documents, PowerPoint presentations, etc.)
  • Add data validation and conditional formatting
  • Export to CSV with performance optimizations
  • Apply advanced formatting and styling options

Architecture

UmyaSpreadsheet follows a modular architecture with specialized function modules:

Core Architecture

UmyaSpreadsheet (Main Module)
 UmyaNative (Rust NIF Interface)
    Spreadsheet Operations (new, read, write)
    Cell Operations (get/set values, formatting)
    Sheet Management (add, remove, rename)
    Native Rust Library (umya-spreadsheet)

 Specialized Function Modules:
     AdvancedFillFunctions - Advanced gradient and pattern fills
     AutoFilterFunctions - Data filtering and sorting
     BackgroundFunctions - Cell background colors and patterns
     BorderFunctions - Cell border styling and formatting
     CellFunctions - Cell value manipulation and retrieval
     ChartFunctions - Chart creation and customization
     CommentFunctions - Cell comment management
     ConditionalFormatting - Advanced conditional formatting rules
     CSVFunctions - CSV export and import operations
     DataValidation - Input validation and dropdown lists
     Drawing - Shapes, connectors, and drawing objects
     FileFormatOptions - File format and compression options
     FontFunctions - Font styling and text formatting
     FormulaFunctions - Formula creation and named ranges
     Hyperlink - Hyperlink management and navigation
     ImageFunctions - Image insertion and positioning
     OleObjects - Object Linking and Embedding (OLE) objects
     PerformanceFunctions - Memory-optimized operations
     PivotTable - Pivot table creation and management
     RichText - Formatted text within cells with styling
     Table - Excel table creation and management
     PrintSettings - Page setup and print configuration
     ProtectionFunctions - Security and access control
     RowColumnFunctions - Row and column operations
     SheetFunctions - Worksheet management and properties
     StyleFunctions - Cell styling and number formatting
     WindowFunctions - View settings and window management

Data Flow

  1. NIF Layer: All operations go through the native interface which interfaces with Rust
  2. Spreadsheet Reference: Operations work on a Rust-managed spreadsheet reference
  3. Function Modules: Specialized modules provide domain-specific functionality
  4. Error Handling: Comprehensive error handling with descriptive messages
  5. Memory Management: Rust handles memory management for performance

Thread Safety

The library is designed for concurrent operations:

  • Each spreadsheet maintains its own Rust reference
  • Multiple spreadsheets can be operated on simultaneously
  • Thread-safe patterns are documented in the guides

Performance Characteristics

  • Memory Efficient: Rust memory management with minimal Elixir overhead
  • Fast I/O: Native Rust file operations for reading/writing
  • Lazy Loading: Optional lazy reading for large files
  • Light Writers: Memory-optimized writers for simple operations
  • Concurrent Safe: Multiple processes can work with different spreadsheets

Compatibility

  • Excel Versions: Full support for Excel 2007+ (.xlsx, .xlsm formats)
  • Elixir Versions: Compatible with Elixir 1.12+
  • OTP Versions: Compatible with OTP 24+
  • Platforms: Linux, macOS, Windows (via precompiled NIFs)

Guides

For detailed guides on specific features, see:

See the Guide Index for a complete list of available guides.

Quick Start

# Create a new spreadsheet
{:ok, spreadsheet} = UmyaSpreadsheet.new()

# Set some cell values
UmyaSpreadsheet.set_cell_value(spreadsheet, "Sheet1", "A1", "Hello")
UmyaSpreadsheet.set_cell_value(spreadsheet, "Sheet1", "B1", "World")

# Apply formatting
UmyaSpreadsheet.set_font_bold(spreadsheet, "Sheet1", "A1", true)
UmyaSpreadsheet.set_background_color(spreadsheet, "Sheet1", "A1", "#FF0000")

# Write to file
UmyaSpreadsheet.write(spreadsheet, "example.xlsx")

Error Handling

Most functions return either :ok or {:error, reason} tuples. Common error patterns:

case UmyaSpreadsheet.set_cell_value(spreadsheet, "NonExistent", "A1", "value") do
  :ok -> IO.puts("Success!")
  {:error, reason} -> IO.puts("Error: #{inspect(reason)}")
end

Summary

Functions

Adds formatted text directly to a RichText object.

Adds an OLE object to a collection.

Adds a TextElement to a RichText object.

Creates a defined name in the spreadsheet with an associated formula.

Creates a named range in the spreadsheet.

Creates a new empty RichText object for building formatted text.

Creates a RichText object from an HTML string with formatting.

Creates a TextElement with text and optional font properties.

Gets all hyperlinks from a worksheet.

Gets the range of an auto filter in a worksheet.

Gets the bx property of a formula.

Gets rich text from a specific cell.

Gets the comment text and author from a cell.

Gets the number of comments in a sheet.

Gets the data table 2D property of a formula.

Gets the data table row property of a formula.

Gets all defined names in the spreadsheet.

Gets the ProgID from embedded object properties.

Gets the shape ID from embedded object properties.

Gets the formula text from a cell.

Gets the complete formula object from a cell, returning detailed information.

Gets the shared index of a formula in a cell.

Gets hyperlink information from a cell.

Gets all hyperlinks from a worksheet (alias for get_all_hyperlinks).

Gets the input 1 deleted property of a formula.

Gets the input 2 deleted property of a formula.

Gets the binary data from an OLE object.

Gets the file extension from an OLE object.

Gets the ProgID from an OLE object.

Gets the properties of an OLE object.

Gets the 'requires' attribute from an OLE object.

Gets the count of OLE objects in a collection.

Gets the OLE objects collection from a worksheet.

Gets the R1 property of a formula.

Gets the R2 property of a formula.

Gets the reference of a formula.

Gets all text elements from a RichText object.

Gets plain text from a RichText object without formatting.

Gets the shared index of a formula.

Gets the text content of a formula in a cell.

Gets font properties from a TextElement as a map.

Gets text content from a TextElement.

Checks if a worksheet has an auto filter.

Checks if a sheet has any comments.

Checks if a specific cell has a hyperlink (alias for has_hyperlink?).

Checks if a specific cell has a hyperlink.

Checks if a worksheet contains any hyperlinks (alias for has_hyperlinks?).

Checks if a worksheet contains any hyperlinks.

Checks if an OLE objects collection has any objects.

Checks if a cell contains a formula.

Checks if an OLE object is in binary format.

Checks if an OLE object is in Excel format.

Reads an Excel (.xlsx, .xlsm) file from the given path using lazy loading. Worksheet contents are only loaded when accessed, which can improve performance for large files.

Lists all OLE objects in a collection.

Loads an OLE object from a file.

Creates a new empty spreadsheet with a default sheet.

Creates new embedded object properties.

Creates a new empty spreadsheet without any default sheets.

Creates a new OLE object.

Creates a new OLE object and loads data from a file.

Creates a new OLE object with binary data.

Creates a new OLE objects collection.

Reads an Excel (.xlsx, .xlsm) file from the given path.

Removes an auto filter from a worksheet.

Converts RichText to HTML representation.

Saves an OLE object to a file.

Sets an array formula for a range of cells. Array formulas can return multiple values across a range of cells.

Sets an auto filter for a range of cells in a worksheet.

Sets the ProgID for embedded object properties.

Sets the shape ID for embedded object properties.

Sets the binary data for an OLE object.

Sets the file extension for an OLE object.

Sets the ProgID for an OLE object.

Sets the properties for an OLE object.

Sets the 'requires' attribute for an OLE object.

Sets the OLE objects collection for a worksheet.

Converts a spreadsheet to binary XLSX format without writing to disk.

Unwraps the reference from a Spreadsheet struct. This is an internal function used by other modules.

Writes a spreadsheet to the specified path.

Writes a spreadsheet to disk with a specified compression level.

Writes a spreadsheet to the specified path with password protection.

Functions

add_above_below_average_rule(spreadsheet, sheet_name, range, rule_type, std_dev, format_style)

See UmyaSpreadsheet.ConditionalFormatting.add_above_below_average_rule/6.

add_cell_is_rule(spreadsheet, sheet_name, range, operator, value1, value2, format_style)

See UmyaSpreadsheet.ConditionalFormatting.add_cell_is_rule/7.

add_cell_value_rule(spreadsheet, sheet_name, range, operator, value1, value2, format_style)

See UmyaSpreadsheet.ConditionalFormatting.add_cell_value_rule/7.

add_chart(spreadsheet, sheet_name, chart_type, from_cell, to_cell, title, data_series, series_titles, point_titles)

See UmyaSpreadsheet.ChartFunctions.add_chart/9.

add_chart_with_options(spreadsheet, sheet_name, chart_type, from_cell, to_cell, title, data_series, series_titles, point_titles, style, vary_colors, view_3d, legend, axes, data_labels)

See UmyaSpreadsheet.ChartFunctions.add_chart_with_options/15.

add_chart_with_options(spreadsheet, sheet_name, chart_type, from_cell, to_cell, title, data_series, series_titles, point_titles, style, vary_colors, view_3d, legend, axes, data_labels, chart_specific)

See UmyaSpreadsheet.ChartFunctions.add_chart_with_options/16.

add_color_scale(spreadsheet, sheet_name, range, min_type, min_value, min_color, max_type, max_value, max_color)

See UmyaSpreadsheet.ConditionalFormatting.add_color_scale/9.

add_color_scale(spreadsheet, sheet_name, range, min_type, min_value, min_color, mid_type, mid_value, mid_color, max_type, max_value, max_color)

See UmyaSpreadsheet.ConditionalFormatting.add_color_scale/12.

add_comment(spreadsheet, sheet_name, cell_address, text, author)

Adds a comment to a cell.

add_connector(spreadsheet, sheet_name, from_cell, to_cell, line_color, line_width)

See UmyaSpreadsheet.Drawing.add_connector/6.

add_custom_validation(spreadsheet, sheet_name, range, formula)

See UmyaSpreadsheet.DataValidation.add_custom_validation/4.

add_custom_validation(spreadsheet, sheet_name, range, formula, error_message)

See UmyaSpreadsheet.DataValidation.add_custom_validation/5.

add_custom_validation(spreadsheet, sheet_name, range, formula, show_dropdown, error_message, error_title, prompt_message, prompt_title)

See UmyaSpreadsheet.DataValidation.add_custom_validation/9.

add_data_bar(spreadsheet, sheet_name, range, min_value, max_value, color)

See UmyaSpreadsheet.ConditionalFormatting.add_data_bar/6.

add_date_validation(spreadsheet, sheet_name, range, operator, value1)

See UmyaSpreadsheet.DataValidation.add_date_validation/5.

add_date_validation(spreadsheet, sheet_name, range, operator, value1, value2)

See UmyaSpreadsheet.DataValidation.add_date_validation/6.

add_date_validation(spreadsheet, sheet_name, range, operator, value1, value2, error_message)

See UmyaSpreadsheet.DataValidation.add_date_validation/7.

add_date_validation(spreadsheet, sheet_name, range, operator, value1, value2, show_dropdown, error_message, error_title, prompt_message, prompt_title)

See UmyaSpreadsheet.DataValidation.add_date_validation/11.

add_formatted_text_to_rich_text(rich_text, text, font_props \\ %{})

Adds formatted text directly to a RichText object.

Examples

iex> rich_text = UmyaSpreadsheet.create_rich_text()
iex> UmyaSpreadsheet.add_formatted_text_to_rich_text(rich_text, "Bold text", %{bold: true})
:ok

add_hyperlink(spreadsheet, sheet_name, cell_address, url, tooltip \\ nil, is_internal \\ false)

Adds a hyperlink to a cell.

add_icon_set(spreadsheet, sheet_name, range, icon_style, thresholds)

See UmyaSpreadsheet.ConditionalFormatting.add_icon_set/5.

add_image(spreadsheet, sheet_name, cell_address, image_path)

See UmyaSpreadsheet.ImageFunctions.add_image/4.

add_list_validation(spreadsheet, sheet_name, range, options)

See UmyaSpreadsheet.DataValidation.add_list_validation/4.

add_list_validation(spreadsheet, sheet_name, range, options, show_dropdown)

See UmyaSpreadsheet.DataValidation.add_list_validation/5.

add_list_validation(spreadsheet, sheet_name, range, options, show_dropdown, error_message)

See UmyaSpreadsheet.DataValidation.add_list_validation/6.

add_list_validation(spreadsheet, sheet_name, range, options, show_dropdown, error_message, error_title, prompt_message, prompt_title)

See UmyaSpreadsheet.DataValidation.add_list_validation/9.

add_merge_cells(spreadsheet, sheet_name, range)

See UmyaSpreadsheet.SheetFunctions.add_merge_cells/3.

add_number_validation(spreadsheet, sheet_name, range, operator, value1)

See UmyaSpreadsheet.DataValidation.add_number_validation/5.

add_number_validation(spreadsheet, sheet_name, range, operator, value1, value2)

See UmyaSpreadsheet.DataValidation.add_number_validation/6.

add_number_validation(spreadsheet, sheet_name, range, operator, value1, value2, error_message)

See UmyaSpreadsheet.DataValidation.add_number_validation/7.

add_number_validation(spreadsheet, sheet_name, range, operator, value1, value2, show_dropdown, error_message, error_title, prompt_message, prompt_title)

See UmyaSpreadsheet.DataValidation.add_number_validation/11.

add_ole_object(ole_objects, ole_object)

Adds an OLE object to a collection.

Examples

iex> {:ok, ole_objects} = UmyaSpreadsheet.new_ole_objects()
iex> {:ok, ole_object} = UmyaSpreadsheet.new_ole_object()
iex> UmyaSpreadsheet.add_ole_object(ole_objects, ole_object)
:ok

add_pivot_table(spreadsheet, sheet_name, name, source_sheet, source_range, target_cell, row_fields, column_fields, data_fields)

See UmyaSpreadsheet.PivotTable.add_pivot_table/9.

add_shape(spreadsheet, sheet_name, cell_address, shape_type, width, height, fill_color, outline_color, outline_width)

See UmyaSpreadsheet.Drawing.add_shape/9.

add_sheet(spreadsheet, sheet_name)

See UmyaSpreadsheet.SheetFunctions.add_sheet/2.

add_table(spreadsheet, sheet_name, table_name, display_name, start_cell, end_cell, columns, has_totals_row \\ nil)

See UmyaSpreadsheet.Table.add_table/8.

add_table_column(spreadsheet, sheet_name, table_name, column_name, totals_row_function \\ nil, totals_row_label \\ nil)

See UmyaSpreadsheet.Table.add_table_column/6.

add_text_box(spreadsheet, sheet_name, cell_address, text, width, height, fill_color, text_color, outline_color, outline_width)

See UmyaSpreadsheet.Drawing.add_text_box/10.

add_text_element_to_rich_text(rich_text, text_element)

Adds a TextElement to a RichText object.

Examples

iex> rich_text = UmyaSpreadsheet.create_rich_text()
iex> element = UmyaSpreadsheet.create_text_element("Test", %{bold: true})
iex> UmyaSpreadsheet.add_text_element_to_rich_text(rich_text, element)
:ok

add_text_length_validation(spreadsheet, sheet_name, range, operator, value1)

See UmyaSpreadsheet.DataValidation.add_text_length_validation/5.

add_text_length_validation(spreadsheet, sheet_name, range, operator, value1, value2)

See UmyaSpreadsheet.DataValidation.add_text_length_validation/6.

add_text_length_validation(spreadsheet, sheet_name, range, operator, value1, value2, error_message)

See UmyaSpreadsheet.DataValidation.add_text_length_validation/7.

add_text_length_validation(spreadsheet, sheet_name, range, operator, value1, value2, show_dropdown, error_message, error_title, prompt_message, prompt_title)

See UmyaSpreadsheet.DataValidation.add_text_length_validation/11.

add_text_rule(spreadsheet, sheet_name, range, operator, text, format_style)

See UmyaSpreadsheet.ConditionalFormatting.add_text_rule/6.

add_top_bottom_rule(spreadsheet, sheet_name, range, rule_type, rank, percent, format_style)

See UmyaSpreadsheet.ConditionalFormatting.add_top_bottom_rule/7.

change_image(spreadsheet, sheet_name, cell_address, new_image_path)

See UmyaSpreadsheet.ImageFunctions.change_image/4.

clear_fill(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.AdvancedFillFunctions.clear_fill/3.

clone_sheet(spreadsheet, source_sheet_name, new_sheet_name)

See UmyaSpreadsheet.SheetFunctions.clone_sheet/3.

copy_column_styling(spreadsheet, sheet_name, source_column, target_column)

See UmyaSpreadsheet.StylingFunctions.copy_column_styling/4.

copy_column_styling(spreadsheet, sheet_name, source_column, target_column, start_row, end_row)

See UmyaSpreadsheet.StylingFunctions.copy_column_styling/6.

copy_row_styling(spreadsheet, sheet_name, source_row, target_row)

See UmyaSpreadsheet.RowColumnFunctions.copy_row_styling/4.

copy_row_styling(spreadsheet, sheet_name, source_row, target_row, start_column, end_column)

See UmyaSpreadsheet.RowColumnFunctions.copy_row_styling/6.

count_pivot_tables(spreadsheet, sheet_name)

See UmyaSpreadsheet.PivotTable.count_pivot_tables/2.

count_tables(spreadsheet, sheet_name)

See UmyaSpreadsheet.Table.count_tables/2.

create_defined_name(spreadsheet, name, formula, sheet_name \\ nil)

Creates a defined name in the spreadsheet with an associated formula.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.create_defined_name(spreadsheet, "TaxRate", "0.15")
:ok

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.create_defined_name(spreadsheet, "Department", "Sales", "Sheet1")
:ok

create_named_range(spreadsheet, name, sheet_name, range)

Creates a named range in the spreadsheet.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.create_named_range(spreadsheet, "MyRange", "Sheet1", "A1:B10")
:ok

create_rich_text()

Creates a new empty RichText object for building formatted text.

Examples

iex> rich_text = UmyaSpreadsheet.create_rich_text()
iex> is_reference(rich_text)
true

create_rich_text_from_html(html)

Creates a RichText object from an HTML string with formatting.

Examples

iex> html = "<b>Bold</b> and <i>italic</i> text"
iex> rich_text = UmyaSpreadsheet.create_rich_text_from_html(html)
iex> is_reference(rich_text)
true

create_text_element(text, font_props \\ %{})

Creates a TextElement with text and optional font properties.

Examples

iex> element = UmyaSpreadsheet.create_text_element("Bold text", %{bold: true, color: "#FF0000"})
iex> is_reference(element)
true

download_image(spreadsheet, sheet_name, cell_address, output_path)

See UmyaSpreadsheet.ImageFunctions.download_image/4.

freeze_panes(spreadsheet, sheet_name, num_rows, num_cols)

See UmyaSpreadsheet.SheetViewFunctions.freeze_panes/4.

get_active_tab(spreadsheet)

See UmyaSpreadsheet.WorkbookViewFunctions.get_active_tab/1.

get_all_hyperlinks(spreadsheet, sheet_name)

Gets all hyperlinks from a worksheet.

get_auto_filter_range(spreadsheet, sheet_name)

Gets the range of an auto filter in a worksheet.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_auto_filter(spreadsheet, "Sheet1", "A1:E10")
iex> UmyaSpreadsheet.get_auto_filter_range(spreadsheet, "Sheet1")
{:ok, "A1:E10"}

get_border_color(spreadsheet, sheet_name, cell_address, border_position)

See UmyaSpreadsheet.CellFunctions.get_border_color/4.

get_border_style(spreadsheet, sheet_name, cell_address, border_position)

See UmyaSpreadsheet.CellFunctions.get_border_style/4.

get_bx(spreadsheet, sheet_name, cell_address)

Gets the bx property of a formula.

The bx property indicates whether the formula calculation should be done on exit from the cell.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_formula(spreadsheet, "Sheet1", "A1", "=SUM(B1:B10)")
iex> UmyaSpreadsheet.get_bx(spreadsheet, "Sheet1", "A1")
nil

get_cell_background_color(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.BackgroundFunctions.get_cell_background_color/3.

get_cell_foreground_color(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.BackgroundFunctions.get_cell_foreground_color/3.

get_cell_format_code(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.CellFunctions.get_cell_format_code/3.

get_cell_hidden(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.CellFunctions.get_cell_hidden/3.

get_cell_horizontal_alignment(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.CellFunctions.get_cell_horizontal_alignment/3.

get_cell_locked(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.CellFunctions.get_cell_locked/3.

get_cell_number_format_id(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.CellFunctions.get_cell_number_format_id/3.

get_cell_pattern_type(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.BackgroundFunctions.get_cell_pattern_type/3.

get_cell_rich_text(spreadsheet, sheet_name, coordinate)

Gets rich text from a specific cell.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> rich_text = UmyaSpreadsheet.get_cell_rich_text(spreadsheet, "Sheet1", "A1")
iex> is_reference(rich_text)
true

get_cell_text_rotation(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.CellFunctions.get_cell_text_rotation/3.

get_cell_value(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.CellFunctions.get_cell_value/3.

get_cell_vertical_alignment(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.CellFunctions.get_cell_vertical_alignment/3.

get_cell_wrap_text(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.CellFunctions.get_cell_wrap_text/3.

get_color_scales(spreadsheet, sheet_name, range)

See UmyaSpreadsheet.ConditionalFormatting.get_color_scales/3.

get_column_auto_width(spreadsheet, sheet_name, column)

See UmyaSpreadsheet.RowColumnFunctions.get_column_auto_width/3.

get_column_hidden(spreadsheet, sheet_name, column)

See UmyaSpreadsheet.RowColumnFunctions.get_column_hidden/3.

get_column_width(spreadsheet, sheet_name, column)

See UmyaSpreadsheet.RowColumnFunctions.get_column_width/3.

get_comment(spreadsheet, sheet_name, cell_address)

Gets the comment text and author from a cell.

get_comments_count(spreadsheet, sheet_name)

Gets the number of comments in a sheet.

get_data_bars(spreadsheet, sheet_name, range)

See UmyaSpreadsheet.ConditionalFormatting.get_data_bars/3.

get_data_table_2d(spreadsheet, sheet_name, cell_address)

Gets the data table 2D property of a formula.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_formula(spreadsheet, "Sheet1", "A1", "=SUM(B1:B10)")
iex> UmyaSpreadsheet.get_data_table_2d(spreadsheet, "Sheet1", "A1")
nil

get_data_table_row(spreadsheet, sheet_name, cell_address)

Gets the data table row property of a formula.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_formula(spreadsheet, "Sheet1", "A1", "=SUM(B1:B10)")
iex> UmyaSpreadsheet.get_data_table_row(spreadsheet, "Sheet1", "A1")
nil

get_defined_names(spreadsheet)

Gets all defined names in the spreadsheet.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.create_named_range(spreadsheet, "MyRange", "Sheet1", "A1:B10")
iex> UmyaSpreadsheet.create_defined_name(spreadsheet, "TaxRate", "0.15")
iex> defined_names = UmyaSpreadsheet.get_defined_names(spreadsheet)
iex> is_list(defined_names)
true

get_embedded_object_prog_id(properties)

Gets the ProgID from embedded object properties.

Examples

iex> {:ok, properties} = UmyaSpreadsheet.new_embedded_object_properties()
iex> :ok = UmyaSpreadsheet.set_embedded_object_prog_id(properties, "Word.Document.12")
iex> {:ok, "Word.Document.12"} = UmyaSpreadsheet.get_embedded_object_prog_id(properties)

get_embedded_object_shape_id(properties)

Gets the shape ID from embedded object properties.

Examples

iex> {:ok, properties} = UmyaSpreadsheet.new_embedded_object_properties()
iex> :ok = UmyaSpreadsheet.set_embedded_object_shape_id(properties, 123)
iex> {:ok, 123} = UmyaSpreadsheet.get_embedded_object_shape_id(properties)

get_fit_to_page(spreadsheet, sheet_name)

See UmyaSpreadsheet.PrintSettings.get_fit_to_page/2.

get_font_bold(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.FontFunctions.get_font_bold/3.

get_font_color(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.FontFunctions.get_font_color/3.

get_font_family(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.FontFunctions.get_font_family/3.

get_font_italic(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.FontFunctions.get_font_italic/3.

get_font_name(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.FontFunctions.get_font_name/3.

get_font_scheme(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.FontFunctions.get_font_scheme/3.

get_font_size(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.FontFunctions.get_font_size/3.

get_font_strikethrough(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.FontFunctions.get_font_strikethrough/3.

get_font_underline(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.FontFunctions.get_font_underline/3.

get_footer(spreadsheet, sheet_name)

See UmyaSpreadsheet.PrintSettings.get_footer/2.

get_formatted_value(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.CellFunctions.get_formatted_value/3.

get_formula(spreadsheet, sheet_name, cell_address)

Gets the formula text from a cell.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_formula(spreadsheet, "Sheet1", "A1", "=SUM(B1:B10)")
iex> UmyaSpreadsheet.get_formula(spreadsheet, "Sheet1", "A1")
"=SUM(B1:B10)"

get_formula_obj(spreadsheet, sheet_name, cell_address)

Gets the complete formula object from a cell, returning detailed information.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_formula(spreadsheet, "Sheet1", "A1", "=SUM(B1:B10)")
iex> {text, type, _shared_index, _reference} = UmyaSpreadsheet.get_formula_obj(spreadsheet, "Sheet1", "A1")
iex> text
"=SUM(B1:B10)"
iex> type
"Normal"

get_formula_shared_index(spreadsheet, sheet_name, cell_address)

Gets the shared index of a formula in a cell.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_formula(spreadsheet, "Sheet1", "A1", "=SUM(B1:B10)")
iex> UmyaSpreadsheet.get_formula_shared_index(spreadsheet, "Sheet1", "A1")
nil

get_formula_type(spreadsheet, sheet_name, cell_address)

Gets the formula type of a cell.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_formula(spreadsheet, "Sheet1", "A1", "=SUM(B1:B10)")
iex> UmyaSpreadsheet.get_formula_type(spreadsheet, "Sheet1", "A1")
"Normal"

get_gradient_fill(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.AdvancedFillFunctions.get_gradient_fill/3.

get_header(spreadsheet, sheet_name)

See UmyaSpreadsheet.PrintSettings.get_header/2.

get_hyperlink(spreadsheet, sheet_name, cell_address)

Gets hyperlink information from a cell.

get_hyperlinks(spreadsheet, sheet_name)

Gets all hyperlinks from a worksheet (alias for get_all_hyperlinks).

get_icon_sets(spreadsheet, sheet_name, range)

See UmyaSpreadsheet.ConditionalFormatting.get_icon_sets/3.

get_image_dimensions(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.ImageFunctions.get_image_dimensions/3.

get_image_info(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.ImageFunctions.get_image_info/3.

get_input_1deleted(spreadsheet, sheet_name, cell_address)

Gets the input 1 deleted property of a formula.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_formula(spreadsheet, "Sheet1", "A1", "=SUM(B1:B10)")
iex> UmyaSpreadsheet.get_input_1deleted(spreadsheet, "Sheet1", "A1")
nil

get_input_2deleted(spreadsheet, sheet_name, cell_address)

Gets the input 2 deleted property of a formula.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_formula(spreadsheet, "Sheet1", "A1", "=SUM(B1:B10)")
iex> UmyaSpreadsheet.get_input_2deleted(spreadsheet, "Sheet1", "A1")
nil

get_ole_object_data(ole_object)

Gets the binary data from an OLE object.

Examples

iex> {:ok, ole_object} = UmyaSpreadsheet.new_ole_object()
iex> {:ok, _data} = UmyaSpreadsheet.get_ole_object_data(ole_object)

get_ole_object_extension(ole_object)

Gets the file extension from an OLE object.

Examples

iex> {:ok, ole_object} = UmyaSpreadsheet.new_ole_object()
iex> :ok = UmyaSpreadsheet.set_ole_object_extension(ole_object, "xlsx")
iex> {:ok, "xlsx"} = UmyaSpreadsheet.get_ole_object_extension(ole_object)

get_ole_object_prog_id(ole_object)

Gets the ProgID from an OLE object.

Examples

iex> {:ok, ole_object} = UmyaSpreadsheet.new_ole_object()
iex> :ok = UmyaSpreadsheet.set_ole_object_prog_id(ole_object, "Excel.Sheet.12")
iex> {:ok, "Excel.Sheet.12"} = UmyaSpreadsheet.get_ole_object_prog_id(ole_object)

get_ole_object_properties(ole_object)

Gets the properties of an OLE object.

Examples

iex> {:ok, ole_object} = UmyaSpreadsheet.new_ole_object()
iex> {:ok, _properties} = UmyaSpreadsheet.get_ole_object_properties(ole_object)

get_ole_object_requires(ole_object)

Gets the 'requires' attribute from an OLE object.

Examples

iex> {:ok, ole_object} = UmyaSpreadsheet.new_ole_object()
iex> :ok = UmyaSpreadsheet.set_ole_object_requires(ole_object, "xl")
iex> {:ok, "xl"} = UmyaSpreadsheet.get_ole_object_requires(ole_object)

get_ole_objects_count(ole_objects)

Gets the count of OLE objects in a collection.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> {:ok, ole_objects} = UmyaSpreadsheet.get_ole_objects_from_worksheet(spreadsheet, "Sheet1")
iex> {:ok, _count} = UmyaSpreadsheet.get_ole_objects_count(ole_objects)

get_ole_objects_from_worksheet(spreadsheet, sheet_name)

Gets the OLE objects collection from a worksheet.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> {:ok, _ole_objects} = UmyaSpreadsheet.get_ole_objects_from_worksheet(spreadsheet, "Sheet1")

get_page_margins(spreadsheet, sheet_name)

See UmyaSpreadsheet.PrintSettings.get_page_margins/2.

get_page_orientation(spreadsheet, sheet_name)

See UmyaSpreadsheet.PrintSettings.get_page_orientation/2.

get_page_scale(spreadsheet, sheet_name)

See UmyaSpreadsheet.PrintSettings.get_page_scale/2.

get_paper_size(spreadsheet, sheet_name)

See UmyaSpreadsheet.PrintSettings.get_paper_size/2.

get_pattern_fill(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.AdvancedFillFunctions.get_pattern_fill/3.

get_pivot_table_fields(spreadsheet, sheet_name, pivot_table_name)

See UmyaSpreadsheet.PivotTable.get_pivot_table_fields/3.

get_pivot_table_info(spreadsheet, sheet_name, pivot_table_name)

See UmyaSpreadsheet.PivotTable.get_pivot_table_info/3.

get_pivot_table_names(spreadsheet, sheet_name)

See UmyaSpreadsheet.PivotTable.get_pivot_table_names/2.

get_pivot_table_source_range(spreadsheet, sheet_name, pivot_table_name)

See UmyaSpreadsheet.PivotTable.get_pivot_table_source_range/3.

get_pivot_table_target_cell(spreadsheet, sheet_name, pivot_table_name)

See UmyaSpreadsheet.PivotTable.get_pivot_table_target_cell/3.

get_print_area(spreadsheet, sheet_name)

See UmyaSpreadsheet.PrintSettings.get_print_area/2.

get_print_centered(spreadsheet, sheet_name)

See UmyaSpreadsheet.PrintSettings.get_print_centered/2.

get_print_titles(spreadsheet, sheet_name)

See UmyaSpreadsheet.PrintSettings.get_print_titles/2.

get_r1(spreadsheet, sheet_name, cell_address)

Gets the R1 property of a formula.

The R1 property is used in data table formulas to specify the first input cell reference.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_formula(spreadsheet, "Sheet1", "A1", "=SUM(B1:B10)")
iex> UmyaSpreadsheet.get_r1(spreadsheet, "Sheet1", "A1")
nil

get_r2(spreadsheet, sheet_name, cell_address)

Gets the R2 property of a formula.

The R2 property is used in data table formulas to specify the second input cell reference.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_formula(spreadsheet, "Sheet1", "A1", "=SUM(B1:B10)")
iex> UmyaSpreadsheet.get_r2(spreadsheet, "Sheet1", "A1")
nil

get_reference(spreadsheet, sheet_name, cell_address)

Gets the reference of a formula.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_array_formula(spreadsheet, "Sheet1", "A1:A3", "ROW(1:3)")
iex> UmyaSpreadsheet.get_reference(spreadsheet, "Sheet1", "A1")
nil

get_rich_text_elements(rich_text)

Gets all text elements from a RichText object.

Examples

iex> rich_text = UmyaSpreadsheet.create_rich_text()
iex> UmyaSpreadsheet.add_formatted_text_to_rich_text(rich_text, "Test", %{bold: true})
iex> elements = UmyaSpreadsheet.get_rich_text_elements(rich_text)
iex> is_list(elements)
true

get_rich_text_plain_text(rich_text)

Gets plain text from a RichText object without formatting.

Examples

iex> rich_text = UmyaSpreadsheet.create_rich_text()
iex> UmyaSpreadsheet.add_formatted_text_to_rich_text(rich_text, "Test", %{bold: true})
iex> UmyaSpreadsheet.get_rich_text_plain_text(rich_text)
"Test"

get_row_height(spreadsheet, sheet_name, row_number)

See UmyaSpreadsheet.RowColumnFunctions.get_row_height/3.

get_row_hidden(spreadsheet, sheet_name, row_number)

See UmyaSpreadsheet.RowColumnFunctions.get_row_hidden/3.

get_selection(spreadsheet, sheet_name)

See UmyaSpreadsheet.SheetViewFunctions.get_selection/2.

get_shared_index(spreadsheet, sheet_name, cell_address)

Gets the shared index of a formula.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_formula(spreadsheet, "Sheet1", "A1", "=A1+1")
iex> UmyaSpreadsheet.get_shared_index(spreadsheet, "Sheet1", "A1")
nil

get_sheet_names(spreadsheet)

See UmyaSpreadsheet.SheetFunctions.get_sheet_names/1.

get_sheet_view(spreadsheet, sheet_name)

See UmyaSpreadsheet.SheetViewFunctions.get_sheet_view/2.

get_show_grid_lines(spreadsheet, sheet_name)

See UmyaSpreadsheet.SheetViewFunctions.get_show_grid_lines/2.

get_tab_color(spreadsheet, sheet_name)

See UmyaSpreadsheet.SheetViewFunctions.get_tab_color/2.

get_table(spreadsheet, sheet_name, table_name)

See UmyaSpreadsheet.Table.get_table/3.

get_table_columns(spreadsheet, sheet_name, table_name)

See UmyaSpreadsheet.Table.get_table_columns/3.

get_table_style(spreadsheet, sheet_name, table_name)

See UmyaSpreadsheet.Table.get_table_style/3.

get_table_totals_row(spreadsheet, sheet_name, table_name)

See UmyaSpreadsheet.Table.get_table_totals_row/3.

get_tables(spreadsheet, sheet_name)

See UmyaSpreadsheet.Table.get_tables/2.

get_text(spreadsheet, sheet_name, cell_address)

Gets the text content of a formula in a cell.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_formula(spreadsheet, "Sheet1", "A1", "=SUM(B1:B10)")
iex> UmyaSpreadsheet.get_text(spreadsheet, "Sheet1", "A1")
"=SUM(B1:B10)"

get_text_element_font_properties(text_element)

Gets font properties from a TextElement as a map.

Examples

iex> element = UmyaSpreadsheet.create_text_element("Test", %{bold: true})
iex> {:ok, props} = UmyaSpreadsheet.get_text_element_font_properties(element)
iex> props[:bold]
"true"

get_text_element_text(text_element)

Gets text content from a TextElement.

Examples

iex> element = UmyaSpreadsheet.create_text_element("Test", %{})
iex> UmyaSpreadsheet.get_text_element_text(element)
"Test"

get_workbook_protection_details(spreadsheet)

See UmyaSpreadsheet.WorkbookProtectionFunctions.get_workbook_protection_details/1.

get_workbook_window_position(spreadsheet)

See UmyaSpreadsheet.WorkbookViewFunctions.get_workbook_window_position/1.

get_zoom_scale(spreadsheet, sheet_name)

See UmyaSpreadsheet.SheetViewFunctions.get_zoom_scale/2.

has_auto_filter(spreadsheet, sheet_name)

Checks if a worksheet has an auto filter.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_auto_filter(spreadsheet, "Sheet1", "A1:E10")
iex> UmyaSpreadsheet.has_auto_filter(spreadsheet, "Sheet1")
{:ok, true}

has_comments(spreadsheet, sheet_name)

Checks if a sheet has any comments.

has_hyperlink(spreadsheet, sheet_name, cell_address)

Checks if a specific cell has a hyperlink (alias for has_hyperlink?).

has_hyperlink?(spreadsheet, sheet_name, cell_address)

Checks if a specific cell has a hyperlink.

has_hyperlinks(spreadsheet, sheet_name)

Checks if a worksheet contains any hyperlinks (alias for has_hyperlinks?).

has_hyperlinks?(spreadsheet, sheet_name)

Checks if a worksheet contains any hyperlinks.

has_ole_objects(ole_objects)

Checks if an OLE objects collection has any objects.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> {:ok, ole_objects} = UmyaSpreadsheet.get_ole_objects_from_worksheet(spreadsheet, "Sheet1")
iex> {:ok, _has_objects} = UmyaSpreadsheet.has_ole_objects(ole_objects)

has_pivot_tables?(spreadsheet, sheet_name)

See UmyaSpreadsheet.PivotTable.has_pivot_tables?/2.

has_tables(spreadsheet, sheet_name)

See UmyaSpreadsheet.Table.has_tables/2.

insert_new_column(spreadsheet, sheet_name, column, amount)

See UmyaSpreadsheet.SheetFunctions.insert_new_column/4.

insert_new_column_by_index(spreadsheet, sheet_name, column_index, amount)

See UmyaSpreadsheet.SheetFunctions.insert_new_column_by_index/4.

insert_new_row(spreadsheet, sheet_name, row_index, amount)

See UmyaSpreadsheet.SheetFunctions.insert_new_row/4.

is_formula(spreadsheet, sheet_name, cell_address)

Checks if a cell contains a formula.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_formula(spreadsheet, "Sheet1", "A1", "=SUM(B1:B10)")
iex> UmyaSpreadsheet.is_formula(spreadsheet, "Sheet1", "A1")
true
iex> UmyaSpreadsheet.is_formula(spreadsheet, "Sheet1", "B1")
false

is_ole_object_binary_format(ole_object)

Checks if an OLE object is in binary format.

Examples

iex> {:ok, ole_object} = UmyaSpreadsheet.new_ole_object()
iex> {:ok, _is_binary} = UmyaSpreadsheet.is_ole_object_binary_format(ole_object)

is_ole_object_excel_format(ole_object)

Checks if an OLE object is in Excel format.

Examples

iex> {:ok, ole_object} = UmyaSpreadsheet.new_ole_object()
iex> {:ok, _is_excel} = UmyaSpreadsheet.is_ole_object_excel_format(ole_object)

is_workbook_protected(spreadsheet)

See UmyaSpreadsheet.WorkbookProtectionFunctions.is_workbook_protected/1.

lazy_read(path)

Reads an Excel (.xlsx, .xlsm) file from the given path using lazy loading. Worksheet contents are only loaded when accessed, which can improve performance for large files.

Parameters

  • path - Path to the Excel file

Examples

iex> result = UmyaSpreadsheet.lazy_read("path/to/file.xlsx")
iex> is_tuple(result)
true

list_images(spreadsheet, sheet_name)

See UmyaSpreadsheet.ImageFunctions.list_images/2.

list_ole_objects(ole_objects)

Lists all OLE objects in a collection.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> {:ok, ole_objects} = UmyaSpreadsheet.get_ole_objects_from_worksheet(spreadsheet, "Sheet1")
iex> {:ok, _objects_list} = UmyaSpreadsheet.list_ole_objects(ole_objects)

load_ole_object_from_file(ole_object, file_path)

Loads an OLE object from a file.

Examples

iex> {:ok, ole_object} = UmyaSpreadsheet.new_ole_object()
iex> {:error, "File not found"} = UmyaSpreadsheet.load_ole_object_from_file(ole_object, "nonexistent.docx")

modify_table_column(spreadsheet, sheet_name, table_name, old_column_name, new_column_name \\ nil, totals_row_function \\ nil, totals_row_label \\ nil)

See UmyaSpreadsheet.Table.modify_table_column/7.

move_range(spreadsheet, sheet_name, range, rows, columns)

See UmyaSpreadsheet.SheetFunctions.move_range/5.

new()

Creates a new empty spreadsheet with a default sheet.

Examples

iex> spreadsheet = UmyaSpreadsheet.new()
iex> match?({:ok, %UmyaSpreadsheet.Spreadsheet{}}, spreadsheet)
true

new_embedded_object_properties()

Creates new embedded object properties.

Examples

iex> {:ok, _properties} = UmyaSpreadsheet.new_embedded_object_properties()

new_empty()

Creates a new empty spreadsheet without any default sheets.

Examples

iex> spreadsheet = UmyaSpreadsheet.new_empty()
iex> match?({:ok, %UmyaSpreadsheet.Spreadsheet{}}, spreadsheet)
true

new_ole_object()

Creates a new OLE object.

Examples

iex> {:ok, _ole_object} = UmyaSpreadsheet.new_ole_object()

new_ole_object_from_file(file_path)

Creates a new OLE object and loads data from a file.

Examples

iex> {:ok, _ole_object} = UmyaSpreadsheet.new_ole_object()

new_ole_object_with_data(data, file_extension)

Creates a new OLE object with binary data.

Examples

iex> _data = "test data"
iex> {:ok, _ole_object} = UmyaSpreadsheet.new_ole_object()

new_ole_objects()

Creates a new OLE objects collection.

Examples

iex> {:ok, _ole_objects} = UmyaSpreadsheet.new_ole_objects()

read(path)

Reads an Excel (.xlsx, .xlsm) file from the given path.

Parameters

  • path - Path to the Excel file

Examples

iex> result = UmyaSpreadsheet.read("path/to/file.xlsx")
iex> is_tuple(result)
true

refresh_all_pivot_tables(spreadsheet)

See UmyaSpreadsheet.PivotTable.refresh_all_pivot_tables/1.

remove_auto_filter(spreadsheet, sheet_name)

Removes an auto filter from a worksheet.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_auto_filter(spreadsheet, "Sheet1", "A1:E10")
iex> UmyaSpreadsheet.remove_auto_filter(spreadsheet, "Sheet1")
:ok

remove_cell(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.CellFunctions.remove_cell/3.

remove_column(spreadsheet, sheet_name, column, amount)

See UmyaSpreadsheet.SheetFunctions.remove_column/4.

remove_column_by_index(spreadsheet, sheet_name, column_index, amount)

See UmyaSpreadsheet.SheetFunctions.remove_column_by_index/4.

remove_comment(spreadsheet, sheet_name, cell_address)

Removes a comment from a cell.

remove_data_validation(spreadsheet, sheet_name, range)

See UmyaSpreadsheet.DataValidation.remove_data_validation/3.

remove_hyperlink(spreadsheet, sheet_name, cell_address)

Removes a hyperlink from a cell.

remove_pivot_table(spreadsheet, sheet_name, pivot_table_name)

See UmyaSpreadsheet.PivotTable.remove_pivot_table/3.

remove_row(spreadsheet, sheet_name, row_index, amount)

See UmyaSpreadsheet.SheetFunctions.remove_row/4.

remove_sheet(spreadsheet, sheet_name)

See UmyaSpreadsheet.SheetFunctions.remove_sheet/2.

remove_table(spreadsheet, sheet_name, table_name)

See UmyaSpreadsheet.Table.remove_table/3.

remove_table_style(spreadsheet, sheet_name, table_name)

See UmyaSpreadsheet.Table.remove_table_style/3.

rename_sheet(spreadsheet, old_sheet_name, new_sheet_name)

See UmyaSpreadsheet.SheetFunctions.rename_sheet/3.

rich_text_to_html(rich_text)

Converts RichText to HTML representation.

Examples

iex> rich_text = UmyaSpreadsheet.create_rich_text()
iex> UmyaSpreadsheet.add_formatted_text_to_rich_text(rich_text, "Bold", %{bold: true})
iex> UmyaSpreadsheet.rich_text_to_html(rich_text)
"<b>Bold</b>"

save_ole_object_to_file(ole_object, file_path)

Saves an OLE object to a file.

Examples

iex> {:ok, ole_object} = UmyaSpreadsheet.new_ole_object()
iex> {:error, "No object data to save"} = UmyaSpreadsheet.save_ole_object_to_file(ole_object, "output.docx")

set_active_tab(spreadsheet, tab_index)

See UmyaSpreadsheet.WorkbookViewFunctions.set_active_tab/2.

set_array_formula(spreadsheet, sheet_name, range, formula)

Sets an array formula for a range of cells. Array formulas can return multiple values across a range of cells.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_array_formula(spreadsheet, "Sheet1", "A1:A3", "ROW(1:3)")
:ok

set_auto_filter(spreadsheet, sheet_name, range)

Sets an auto filter for a range of cells in a worksheet.

Auto filters allow users to filter data in Excel by adding dropdown menus to column headers.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_auto_filter(spreadsheet, "Sheet1", "A1:E10")
:ok

set_background_color(spreadsheet, sheet_name, cell_address, color)

See UmyaSpreadsheet.BackgroundFunctions.set_background_color/4.

set_border_style(spreadsheet, sheet_name, cell_address, border_position, border_style)

See UmyaSpreadsheet.BorderFunctions.set_border_style/5.

set_cell_alignment(spreadsheet, sheet_name, cell_address, horizontal, vertical)

See UmyaSpreadsheet.CellFunctions.set_cell_alignment/5.

set_cell_indent(spreadsheet, sheet_name, cell_address, level)

See UmyaSpreadsheet.CellFunctions.set_cell_indent/4.

set_cell_rich_text(spreadsheet, sheet_name, coordinate, rich_text)

Sets rich text to a specific cell.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> rich_text = UmyaSpreadsheet.create_rich_text()
iex> UmyaSpreadsheet.add_formatted_text_to_rich_text(rich_text, "Test", %{bold: true})
iex> UmyaSpreadsheet.set_cell_rich_text(spreadsheet, "Sheet1", "A1", rich_text)
:ok

set_cell_rotation(spreadsheet, sheet_name, cell_address, angle)

See UmyaSpreadsheet.CellFunctions.set_cell_rotation/4.

set_cell_value(spreadsheet, sheet_name, cell_address, value)

See UmyaSpreadsheet.CellFunctions.set_cell_value/4.

set_chart_3d_view(spreadsheet, sheet_name, chart_index, rot_x, rot_y, perspective, height_percent)

See UmyaSpreadsheet.ChartFunctions.set_chart_3d_view/7.

set_chart_axis_titles(spreadsheet, sheet_name, chart_index, category_axis_title, value_axis_title)

See UmyaSpreadsheet.ChartFunctions.set_chart_axis_titles/5.

set_chart_data_labels(spreadsheet, sheet_name, chart_index, show_values, show_percent, show_category_name, show_series_name, position)

See UmyaSpreadsheet.ChartFunctions.set_chart_data_labels/8.

set_chart_legend_position(spreadsheet, sheet_name, chart_index, position, overlay)

See UmyaSpreadsheet.ChartFunctions.set_chart_legend_position/5.

set_chart_style(spreadsheet, sheet_name, chart_index, style)

See UmyaSpreadsheet.ChartFunctions.set_chart_style/4.

set_column_auto_width(spreadsheet, sheet_name, column, auto_width)

See UmyaSpreadsheet.RowColumnFunctions.set_column_auto_width/4.

set_column_width(spreadsheet, sheet_name, column, width)

See UmyaSpreadsheet.RowColumnFunctions.set_column_width/4.

set_custom_gradient_fill(spreadsheet, sheet_name, cell_address, degree, gradient_stops)

See UmyaSpreadsheet.AdvancedFillFunctions.set_custom_gradient_fill/5.

set_custom_gradient_fill(spreadsheet, sheet_name, cell_address, degree, gradient_stops, validate_positions)

See UmyaSpreadsheet.AdvancedFillFunctions.set_custom_gradient_fill/6.

set_embedded_object_prog_id(properties, prog_id)

Sets the ProgID for embedded object properties.

Examples

iex> {:ok, properties} = UmyaSpreadsheet.new_embedded_object_properties()
iex> UmyaSpreadsheet.set_embedded_object_prog_id(properties, "Word.Document.12")
:ok

set_embedded_object_shape_id(properties, shape_id)

Sets the shape ID for embedded object properties.

Examples

iex> {:ok, properties} = UmyaSpreadsheet.new_embedded_object_properties()
iex> UmyaSpreadsheet.set_embedded_object_shape_id(properties, 123)
:ok

set_fit_to_page(spreadsheet, sheet_name, width, height)

See UmyaSpreadsheet.PrintSettings.set_fit_to_page/4.

set_font_bold(spreadsheet, sheet_name, cell_address, is_bold)

See UmyaSpreadsheet.FontFunctions.set_font_bold/4.

set_font_color(spreadsheet, sheet_name, cell_address, color)

See UmyaSpreadsheet.FontFunctions.set_font_color/4.

set_font_family(spreadsheet, sheet_name, cell_address, font_family)

See UmyaSpreadsheet.FontFunctions.set_font_family/4.

set_font_italic(spreadsheet, sheet_name, cell_address, is_italic)

See UmyaSpreadsheet.FontFunctions.set_font_italic/4.

set_font_name(spreadsheet, sheet_name, cell_address, font_name)

See UmyaSpreadsheet.FontFunctions.set_font_name/4.

set_font_scheme(spreadsheet, sheet_name, cell_address, font_scheme)

See UmyaSpreadsheet.FontFunctions.set_font_scheme/4.

set_font_size(spreadsheet, sheet_name, cell_address, size)

See UmyaSpreadsheet.FontFunctions.set_font_size/4.

set_font_strikethrough(spreadsheet, sheet_name, cell_address, is_strikethrough)

See UmyaSpreadsheet.FontFunctions.set_font_strikethrough/4.

set_font_underline(spreadsheet, sheet_name, cell_address, underline_style)

See UmyaSpreadsheet.FontFunctions.set_font_underline/4.

set_footer(spreadsheet, sheet_name, footer_text)

See UmyaSpreadsheet.PrintSettings.set_footer/3.

set_formula(spreadsheet, sheet_name, cell_address, formula)

Sets a regular formula in a cell.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> UmyaSpreadsheet.set_formula(spreadsheet, "Sheet1", "A1", "SUM(B1:B10)")
:ok

set_gradient_fill(spreadsheet, sheet_name, cell_address, degree, gradient_stops)

See UmyaSpreadsheet.AdvancedFillFunctions.set_gradient_fill/5.

set_header(spreadsheet, sheet_name, header_text)

See UmyaSpreadsheet.PrintSettings.set_header/3.

set_linear_gradient_fill(spreadsheet, sheet_name, cell_address, start_color, end_color)

See UmyaSpreadsheet.AdvancedFillFunctions.set_linear_gradient_fill/5.

set_linear_gradient_fill(spreadsheet, sheet_name, cell_address, start_color, end_color, angle)

See UmyaSpreadsheet.AdvancedFillFunctions.set_linear_gradient_fill/6.

set_number_format(spreadsheet, sheet_name, cell_address, format_code)

See UmyaSpreadsheet.CellFunctions.set_number_format/4.

set_ole_object_data(ole_object, data)

Sets the binary data for an OLE object.

Examples

iex> {:ok, ole_object} = UmyaSpreadsheet.new_ole_object()
iex> :ok = UmyaSpreadsheet.set_ole_object_data(ole_object, "test data")

set_ole_object_extension(ole_object, extension)

Sets the file extension for an OLE object.

Examples

iex> {:ok, ole_object} = UmyaSpreadsheet.new_ole_object()
iex> UmyaSpreadsheet.set_ole_object_extension(ole_object, "xlsx")
:ok

set_ole_object_prog_id(ole_object, prog_id)

Sets the ProgID for an OLE object.

Examples

iex> {:ok, ole_object} = UmyaSpreadsheet.new_ole_object()
iex> UmyaSpreadsheet.set_ole_object_prog_id(ole_object, "Excel.Sheet.12")
:ok

set_ole_object_properties(ole_object, properties)

Sets the properties for an OLE object.

Examples

iex> {:ok, ole_object} = UmyaSpreadsheet.new_ole_object()
iex> {:ok, properties} = UmyaSpreadsheet.new_embedded_object_properties()
iex> UmyaSpreadsheet.set_ole_object_properties(ole_object, properties)
:ok

set_ole_object_requires(ole_object, requires)

Sets the 'requires' attribute for an OLE object.

Examples

iex> {:ok, ole_object} = UmyaSpreadsheet.new_ole_object()
iex> UmyaSpreadsheet.set_ole_object_requires(ole_object, "xl")
:ok

set_ole_objects_to_worksheet(spreadsheet, sheet_name, ole_objects)

Sets the OLE objects collection for a worksheet.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> {:ok, ole_objects} = UmyaSpreadsheet.new_ole_objects()
iex> UmyaSpreadsheet.set_ole_objects_to_worksheet(spreadsheet, "Sheet1", ole_objects)
:ok

set_page_margins(spreadsheet, sheet_name, top, right, bottom, left)

See UmyaSpreadsheet.PrintSettings.set_page_margins/6.

set_page_orientation(spreadsheet, sheet_name, orientation)

See UmyaSpreadsheet.PrintSettings.set_page_orientation/3.

set_page_scale(spreadsheet, sheet_name, scale)

See UmyaSpreadsheet.PrintSettings.set_page_scale/3.

set_paper_size(spreadsheet, sheet_name, paper_size)

See UmyaSpreadsheet.PrintSettings.set_paper_size/3.

set_password(input_path, output_path, password)

See UmyaSpreadsheet.WorkbookFunctions.set_password/3.

set_pattern_fill(spreadsheet, sheet_name, cell_address, pattern_type, foreground_color)

See UmyaSpreadsheet.AdvancedFillFunctions.set_pattern_fill/5.

set_pattern_fill(spreadsheet, sheet_name, cell_address, pattern_type, foreground_color, background_color)

See UmyaSpreadsheet.AdvancedFillFunctions.set_pattern_fill/6.

set_print_area(spreadsheet, sheet_name, range)

See UmyaSpreadsheet.PrintSettings.set_print_area/3.

set_print_centered(spreadsheet, sheet_name, horizontal_centered, vertical_centered)

See UmyaSpreadsheet.PrintSettings.set_print_centered/4.

set_print_titles(spreadsheet, sheet_name, rows, columns)

See UmyaSpreadsheet.PrintSettings.set_print_titles/4.

set_radial_gradient_fill(spreadsheet, sheet_name, cell_address, center_color, edge_color)

See UmyaSpreadsheet.AdvancedFillFunctions.set_radial_gradient_fill/5.

set_row_height(spreadsheet, sheet_name, row_number, height)

See UmyaSpreadsheet.RowColumnFunctions.set_row_height/4.

set_row_style(spreadsheet, sheet_name, row_number, bg_color, font_color)

See UmyaSpreadsheet.RowColumnFunctions.set_row_style/5.

set_selection(spreadsheet, sheet_name, active_cell, sqref)

See UmyaSpreadsheet.SheetViewFunctions.set_selection/4.

set_sheet_protection(spreadsheet, sheet_name, password, is_protected)

See UmyaSpreadsheet.SheetFunctions.set_sheet_protection/4.

set_sheet_state(spreadsheet, sheet_name, state)

See UmyaSpreadsheet.SheetFunctions.set_sheet_state/3.

set_sheet_view(spreadsheet, sheet_name, view_type)

See UmyaSpreadsheet.SheetViewFunctions.set_sheet_view/3.

set_show_grid_lines(spreadsheet, sheet_name, show_gridlines)

See UmyaSpreadsheet.SheetViewFunctions.set_show_grid_lines/3.

set_tab_color(spreadsheet, sheet_name, color)

See UmyaSpreadsheet.SheetViewFunctions.set_tab_color/3.

set_tab_selected(spreadsheet, sheet_name, selected)

See UmyaSpreadsheet.SheetViewFunctions.set_tab_selected/3.

set_table_style(spreadsheet, sheet_name, table_name, style_name, show_first_col, show_last_col, show_row_stripes, show_col_stripes)

See UmyaSpreadsheet.Table.set_table_style/8.

set_table_totals_row(spreadsheet, sheet_name, table_name, show_totals_row)

See UmyaSpreadsheet.Table.set_table_totals_row/4.

set_three_color_gradient_fill(spreadsheet, sheet_name, cell_address, start_color, middle_color, end_color)

See UmyaSpreadsheet.AdvancedFillFunctions.set_three_color_gradient_fill/6.

set_three_color_gradient_fill(spreadsheet, sheet_name, cell_address, start_color, middle_color, end_color, angle)

See UmyaSpreadsheet.AdvancedFillFunctions.set_three_color_gradient_fill/7.

set_top_left_cell(spreadsheet, sheet_name, cell_address)

See UmyaSpreadsheet.SheetViewFunctions.set_top_left_cell/3.

set_workbook_protection(spreadsheet, password)

See UmyaSpreadsheet.WorkbookFunctions.set_workbook_protection/2.

set_workbook_window_position(spreadsheet, x_position, y_position, window_width, window_height)

See UmyaSpreadsheet.WorkbookViewFunctions.set_workbook_window_position/5.

set_wrap_text(spreadsheet, sheet_name, cell_address, wrap)

See UmyaSpreadsheet.CellFunctions.set_wrap_text/4.

set_zoom_scale(spreadsheet, sheet_name, scale)

See UmyaSpreadsheet.SheetViewFunctions.set_zoom_scale/3.

set_zoom_scale_normal(spreadsheet, sheet_name, scale)

See UmyaSpreadsheet.SheetViewFunctions.set_zoom_scale_normal/3.

set_zoom_scale_page_break(spreadsheet, sheet_name, scale)

See UmyaSpreadsheet.SheetViewFunctions.set_zoom_scale_page_break/3.

set_zoom_scale_page_layout(spreadsheet, sheet_name, scale)

See UmyaSpreadsheet.SheetViewFunctions.set_zoom_scale_page_layout/3.

split_panes(spreadsheet, sheet_name, x_split, y_split)

See UmyaSpreadsheet.SheetViewFunctions.split_panes/4.

to_binary_xlsx(spreadsheet)

Converts a spreadsheet to binary XLSX format without writing to disk.

This is useful for serving Excel files directly in web applications.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> binary = UmyaSpreadsheet.to_binary_xlsx(spreadsheet)
iex> is_binary(binary)
true

unwrap_ref(ref)

@spec unwrap_ref(UmyaSpreadsheet.Spreadsheet.t() | reference()) :: reference()

Unwraps the reference from a Spreadsheet struct. This is an internal function used by other modules.

update_comment(spreadsheet, sheet_name, cell_address, text, author \\ nil)

Updates an existing comment in a cell.

update_hyperlink(spreadsheet, sheet_name, cell_address, url, tooltip \\ nil, is_internal \\ false)

Updates an existing hyperlink in a cell.

write(spreadsheet, path)

Writes a spreadsheet to the specified path.

Parameters

  • spreadsheet - A spreadsheet struct
  • path - The path where to save the Excel file

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> result = UmyaSpreadsheet.write(spreadsheet, "path/to/output.xlsx")
iex> is_atom(result) or is_tuple(result)
true

write_csv(spreadsheet, sheet_name, path)

See UmyaSpreadsheet.CSVFunctions.write_csv/3.

write_csv(spreadsheet, sheet_name, path, options)

See UmyaSpreadsheet.CSVFunctions.write_csv/4.

write_csv_with_options(spreadsheet, sheet_name, path, options)

See UmyaSpreadsheet.CSVFunctions.write_csv_with_options/4.

write_light(spreadsheet, path)

See UmyaSpreadsheet.PerformanceFunctions.write_light/2.

write_with_compression(spreadsheet, path, compression_level)

Writes a spreadsheet to disk with a specified compression level.

Compression levels range from 0 (no compression) to 9 (maximum compression). Higher compression levels result in smaller files but take longer to create.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> unique_id = :crypto.strong_rand_bytes(4) |> Base.encode16() |> String.downcase()
iex> file_path = "test/result_files/high_compression_" <> unique_id <> ".xlsx"
iex> File.mkdir_p!(Path.dirname(file_path))
iex> if File.exists?(file_path), do: File.rm!(file_path)
iex> UmyaSpreadsheet.write_with_compression(spreadsheet, file_path, 9)
:ok
iex> File.exists?(file_path)
true
iex> File.rm!(file_path)
:ok

write_with_encryption_options(spreadsheet, path, password, algorithm, salt_value \\ nil, spin_count \\ nil)

Writes a spreadsheet to disk with enhanced encryption options.

This function provides more control over the encryption process than the standard write_with_password function, allowing you to specify encryption algorithm, salt values, and spin counts for enhanced security.

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> unique_id = :crypto.strong_rand_bytes(4) |> Base.encode16() |> String.downcase()
iex> file_path = "test/result_files/secure_options_" <> unique_id <> ".xlsx"
iex> File.mkdir_p!(Path.dirname(file_path))
iex> if File.exists?(file_path), do: File.rm!(file_path)
iex> UmyaSpreadsheet.write_with_encryption_options(spreadsheet, file_path, "secret", "AES256")
:ok
iex> File.exists?(file_path)
true
iex> File.rm!(file_path)
:ok

write_with_password(spreadsheet, path, password)

Writes a spreadsheet to the specified path with password protection.

Parameters

  • spreadsheet - A spreadsheet struct
  • path - The path where to save the Excel file
  • password - Password for the Excel file

Examples

iex> {:ok, spreadsheet} = UmyaSpreadsheet.new()
iex> unique_id = :crypto.strong_rand_bytes(4) |> Base.encode16() |> String.downcase()
iex> file_path = "test/result_files/secure_password_" <> unique_id <> ".xlsx"
iex> File.mkdir_p!(Path.dirname(file_path))
iex> if File.exists?(file_path), do: File.rm!(file_path)
iex> UmyaSpreadsheet.write_with_password(spreadsheet, file_path, "password123")
:ok
iex> File.exists?(file_path)
true
iex> File.rm!(file_path)
:ok

write_with_password_light(spreadsheet, path, password)

See UmyaSpreadsheet.PerformanceFunctions.write_with_password_light/3.