There's a very convenient way of reading Excel files in Erlang/Elixir using ODBC
.
For example:
def open(src) do
conn = "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};
DBQ=#{src};"
{:ok, pid} =
:odbc.connect(to_charlist(conn),
timeout: 10000,
binary_strings: :on,
tuple_row: :off,
scrollable_cursors: :off,
trace_driver: :off,
extended_errors: :on
)
result = :odbc.sql_query(pid, to_charlist("select * from [Sheet1$]"))
:odbc.disconnect(pid)
result
end
However this requires that we know the name of the excel sheets ahead of time.
Is there a way to get the list of sheet-names from the Excel file?
what would be the equivalent of OdbcConnection.GetSchema("Tables")
in Erlang ?