13
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ElixirAdvent Calendar 2022

Day 1

xlsxデータを読み込んで出力してみる

Last updated at Posted at 2022-12-24

Brightの対象

Webアプリ開発 Elixir > クラス1 > Elixir Web/ライブラリ > CSV/Excel > Xlsxir


使うライブラリ

ソース例

Xlsxファイルを読み込んで0シート目の内容をタブ区切りで表示します

Mix.install([{:xlsxir, "~> 1.6"}])

{:ok, tid} = Xlsxir.multi_extract("./test.xlsx", 0)
Xlsxir.get_list(tid)
|> Enum.each(&Enum.join(&1, "\t") |> IO.puts)
Xlsxir.close(tid)

実行例
image.png

データ例
Screenshot from 2022-12-24 22-45-36.png

応用すれば、xlsxファイルからデータを読み込んでデータ加工ができそうですね

13
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?