Node.js で Excel ファイルをパースしてデータ抽出するときの備忘録


覚えておきたいことだけ書く。

リファレンス

セルの指定方法

'A1', 'A2' と指定するのが基本。
隣のセルとかを指定するには、セルをエンコードして操作する。

Cell and cell address manipulation:

  • format_cell generates the text value for a cell (using number formats).
  • encode_row / decode_row converts between 0-indexed rows and 1-indexed rows.
  • encode_col / decode_col converts between 0-indexed columns and column names.
  • encode_cell / decode_cell converts cell addresses.
  • encode_range / decode_range converts cell ranges.

値の取得

セルオブジェクトには、v(raw value), w(formatted value), t(type) の値がある。
数字は変な値になる。日付とかはvで取れない。
なので、基本はwで取得する。

参考

https://www.kwbtblog.com/entry/2019/09/27/122318
https://photo-tea.com/p/17/excel-parse-javascript-node/#%E3%82%A8%E3%82%AF%E3%82%BB%E3%83%AB%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%AE%E4%B8%AD%E8%BA%AB%E3%82%92nodejs%E3%81%A7%E8%A7%A3%E6%9E%90
https://qiita.com/indometacin/items/020513f7801a040dab33