0
0

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.

openpyxlでiter_rowsを先頭に戻すには、load_workbookでファイルを読み込み直すしかなさそう

Posted at

やろうとしたこと

  • pythonでEXCELを読み書きできるopenpyxlライブラリがある
  • iter_rowsメソッドでEXCELを1行ずつ読み出せる(DBのカーソルに似ている)
  • ws.append()で行を追加した後で、先頭からもう一度処理しようとすると、イテレータが末尾に移動したままで、先頭に戻らない

考えたこと

対応

  • load_workbookでファイルを読み込み直す

環境

  • Python 3.6.9
  • openpyxl 3.0.5
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?