### Open XLSX from Memory (Binary) Source: https://github.com/xavier/xlsx_reader/blob/master/README.md Illustrates how to load XLSX data directly from a binary string in memory using `XlsxReader.open` with the `:source` option set to `:binary`. ```elixir blob = File.read!("test.xlsx") {:ok, package} = XlsxReader.open(blob, source: :binary) ``` -------------------------------- ### Open XLSX File from File System Source: https://github.com/xavier/xlsx_reader/blob/master/README.md Demonstrates opening an XLSX file located on the file system using `XlsxReader.open`. It then shows how to retrieve the names of all sheets within the package and load data from a specific sheet. ```elixir {:ok, package} = XlsxReader.open("test.xlsx") XlsxReader.sheet_names(package) # ["Sheet 1", "Sheet 2", "Sheet 3"] {:ok, rows} = XlsxReader.sheet(package, "Sheet 1") # [ # ["Date", "Temperature"], # [~D[2019-11-01], 8.4], # [~D[2019-11-02], 7.5], # ... # ] ``` -------------------------------- ### Add XlsxReader Dependency to mix.exs Source: https://github.com/xavier/xlsx_reader/blob/master/README.md Shows how to add the XlsxReader library as a dependency in an Elixir project's `mix.exs` file. This is the first step to using the library. ```elixir def deps do [ {:xlsx_reader, ">~ 0.8.0"} ] end ``` -------------------------------- ### Load All Sheets at Once Source: https://github.com/xavier/xlsx_reader/blob/master/README.md Shows how to load all sheets from an XLSX package into a list of tuples, where each tuple contains the sheet name and its row data. ```elixir {:ok, sheets} = XlsxReader.sheets(package) # [ # {"Sheet 1", [["Date", "Temperature"], ...]}, # {"Sheet 2", [...]}, # ... # ] ``` -------------------------------- ### Load All Sheets Concurrently Source: https://github.com/xavier/xlsx_reader/blob/master/README.md Explains how to load all sheets from an XLSX package concurrently using `XlsxReader.async_sheets`, which can improve performance for files with many sheets. ```elixir {:ok, sheets} = XlsxReader.async_sheets(package) # [ # {"Sheet 1", [["Date", "Temperature"], ...]}, # {"Sheet 2", [...]}, # ... # ] ``` -------------------------------- ### Access Cell Formulas and Data Source: https://github.com/xavier/xlsx_reader/blob/master/README.md Demonstrates how to retrieve detailed cell data, including formulas and references, by setting `cell_data_format: :cell` when loading a sheet. ```elixir {:ok, rows} = XlsxReader.sheet(package, "Sheet 1", cell_data_format: :cell) # [ # [%Cell{value: 1234.0, formula: "SUM(B1, B10)", ref: "A1"}, ...], # ... # ] ``` -------------------------------- ### Load Sheets Selectively Source: https://github.com/xavier/xlsx_reader/blob/master/README.md Demonstrates loading specific sheets from an XLSX package by providing a list of sheet names or regular expressions to the `only` option, and excluding others with the `except` option. ```elixir {:ok, sheets} = XlsxReader.sheets(package, only: ["Parameters", ~r/Sheet \d+/], except: ["Sheet 2"]) # [ # {"Parameters", [...]}, # {"Sheet 1", [...]}, # {"Sheet 3", [...]}, # {"Sheet 4", [...]}, # ... # ] ``` -------------------------------- ### Use Arbitrary Precision Numbers Source: https://github.com/xavier/xlsx_reader/blob/master/README.md Shows how to configure XlsxReader to parse numbers as arbitrary precision `Decimal` types by passing `number_type: Decimal` to the `XlsxReader.sheet` function. ```elixir {:ok, rows} = XlsxReader.sheet(package, "Sheet 1", number_type: Decimal) # [ # ["Date", "Temperature"], # [~D[2019-11-01], %Decimal{coef: 84, exp: -1, sign: 1}], # [~D[2019-11-02], %Decimal{coef: 75, exp: -1, sign: 1}], # ... # ] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.