【发布时间】:2018-12-14 21:55:46
【问题描述】:
在 Erlang/Elixir 中使用 ODBC 读取 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 表格的名称。
有没有办法从 Excel 文件中获取 工作表名称 列表?
在 Erlang 中,OdbcConnection.GetSchema("Tables") 是什么?
【问题讨论】: