在 Elixir / Erlang 中获取 excel 个工作表的名称

Get names of excel worksheets in Elixir / Erlang

使用 ODBC.

可以非常方便地读取 Erlang/Elixir 中的 Excel 文件

例如:

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

然而,这需要我们提前知道 excel sheet 的名字

有没有办法从 Excel 文件中获取 sheet-names 的列表?

Erlang 中 OdbcConnection.GetSchema("Tables") 的等价物是什么?

我快速浏览了一下 the source code for the Erlang ODBC server。如果我理解正确,获取表列表需要调用 ODBC 库中的 SQLTables 函数,但服务器中没有这样的调用 - 据我所知,目前这是不可能的。 (可能会欢迎实现此的拉取请求)