2
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?

More than 3 years have passed since last update.

Pythonでread_excel()を記述するとエラーになる件

Last updated at Posted at 2021-02-27

Widnws10 Pro
Python 3.9

Pythonでエクセルを操作してするコードを書いた。
以下のエラーが発生した


raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')
xlrd.biffh.XLRDError: Excel xlsx file; not supported

[pandas+xlrdでxlsxを開こうとするとxlrd.biffh.XLRDError: Excel xlsx file; not supportedのエラーが出る ](https://heppoco-cto.com/pandasxlrd%E3%81%A7xlsx%E3%82%92%E9%96%8B%E3%81%93%E3%81%86%E3%81%A8%E3%81%99%E3%82%8B%E3%81%A8xlrd-biffh-xlrderror-excel-xlsx-file-not-supported%E3%81%AE%E3%82%A8%E3%83%A9%E3%83%BC%E3%81%8C/468/)
を参考に以下のコマンドを実行してインストールした。

pip install xlrd==1.2.0


すると、今度はエラーが変わった。


AttributeError: 'ElementTree' object has no attribute 'getiterator'

[Pyhon 3.9 で pandasでread_excel()すると、AttributeError: 'ElementTree' object has no attribute 'getiterator'](https://osamuk.hatenablog.jp/entry/2020/10/20/215654)
を参考にして

df_order = pd.read_excel(filepath)から
pd.read_excel(filepath,engine="openpyxl")に修正


無事コードが通った。



2
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
2
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?