Xlsxir v1.6.4 Xlsxir.XlsxFile View Source

Struct and helper functions to extract and process .xslx files

Example

iex> xlsx_file = Xlsxir.XlsxFile.initialize("./test/test_data/test.xlsx") iex> {:ok, _tid} = Xlsxir.XlsxFile.parse_to_ets(xlsx_file, 0) iex> Xlsxir.XlsxFile.clean(xlsx_file) :ok

Link to this section Summary

Functions

Clean temp ETS tables and extraction folder

Extract and prepare .xlsx file content

Parse all worksheets of the XlsxFile and store their content in ETS tables. returns [{:ok, worksheet_1_table_id}, ..., {:ok, worksheet_n_table_id}] when timer is false and [{:ok, worksheet_1_table_id, time1}, ..., {:ok, worksheet_n_table_id, timen}] when timer is true

Parse a worksheet of the XlsxFile and store its content in a ETS table. returns {:ok, table_id} when timer is false and {:ok, table_id, time} when timer is true

Parse a worksheet of the XlsxFile as a stream

Link to this section Functions

Clean temp ETS tables and extraction folder

Link to this function

initialize(xlsx_filepath, options \\ []) View Source

Extract and prepare .xlsx file content.

Parameters

  • path - file path of a .xlsx file type in string format

Options

  • :max_rows - the number of rows to fetch from within the worksheet
  • :extract_to - Specify how the .xlsx content (i.e. sharedStrings.xml, style.xml and worksheets xml files) will be be extracted before being parsed. :memory will extract files to memory, and :file to files in the file system
  • :extract_base_dir - when extracting to file, files will be extracted in a sub directory in the :extract_base_dir directory. Defaults to Application.get_env(:xlsxir, :extract_base_dir) or "temp"
Link to this function

parse_all_to_ets(xlsx_file, timer \\ false) View Source

Parse all worksheets of the XlsxFile and store their content in ETS tables. returns [{:ok, worksheet_1_table_id}, ..., {:ok, worksheet_n_table_id}] when timer is false and [{:ok, worksheet_1_table_id, time1}, ..., {:ok, worksheet_n_table_id, timen}] when timer is true

Link to this function

parse_to_ets(xlsx_file, worksheet_index_or_file, timer \\ false) View Source

Parse a worksheet of the XlsxFile and store its content in a ETS table. returns {:ok, table_id} when timer is false and {:ok, table_id, time} when timer is true

Link to this function

stream(xlsx_filepath, worksheet_index, options \\ []) View Source

Parse a worksheet of the XlsxFile as a stream