Top Level Methods

This module provides a set of top-level methods for creating and loading IronCalc models. All locale, tz and language_id parameters default to "en", "UTC" and "en".

Creating models (raw API)

create(name, locale='en', tz='UTC', language_id='en') → Model

Creates an empty workbook with the raw API.

load_from_xlsx(file_path, locale='en', tz='UTC', language_id='en') → Model

Loads a workbook from an xlsx file.

load_from_icalc(file_name, language_id='en') → Model

Loads a workbook from a file in the internal binary ic format.

load_from_bytes(bytes, language_id='en') → Model

Loads a workbook from bytes in the internal binary ic format (the format produced by to_bytes and save_to_icalc).

Creating models (user API)

The UserModel constructor and static methods are the idiomatic way:

model = ic.UserModel("My Workbook")
model = ic.UserModel.from_xlsx("book.xlsx")
model = ic.UserModel.from_icalc("book.ic")
model = ic.UserModel.from_bytes(data)

The equivalent top-level functions are also available:

create_user_model(name, locale='en', tz='UTC', language_id='en') → UserModel
create_user_model_from_xlsx(file_path, locale='en', tz='UTC', language_id='en') → UserModel
create_user_model_from_icalc(file_name, language_id='en') → UserModel
create_user_model_from_bytes(bytes, language_id='en') → UserModel

Utilities

column_name_from_number(column: int) → str

Returns the column name (“A”, “B”, …, “XFD”) for a 1-based column number.

column_number_from_name(column: str) → int

Returns the 1-based column number for a column name.

quote_name(name: str) → str

Quotes a sheet name if needed so it can be used in a formula reference ("My Sheet" -> "'My Sheet'").

get_all_timezones() → list[str]

Returns the list of supported timezones.

get_supported_locales() → list[str]

Returns the list of supported locales.

get_theme_list() → list[dict]

Returns the built-in themes, in the same shape used by get_theme and set_theme.

hex_with_tint_to_rgb(hex: str, tint: float) → str

Applies a tint (-1.0 darkest to 1.0 lightest) to a "#RRGGBB" color and returns the resulting "#RRGGBB" color. This is how theme colors [theme_index, tint] are resolved.