銀の弾丸、はじめました

Unityとかガジェットとか

UserWarning: Call to deprecated function or class get_active_sheet (Use the .active property). def get_active_sheet(self):の対処方法

openpyxlの get_active_sheet() でWarning

/usr/local/lib/python2.7/site-packages/openpyxl/workbook/workbook.py:102: UserWarning: Call to deprecated function or class get_active_sheet (Use the .active property).
  def get_active_sheet(self):

openpyxl は2.3.5を使用.いつの間にかWarningが出るようになった(openpyxlアプデしてた)

解決策

.active を使う.

from openpyxl import load_workbook

wb=load_workbook('./__HOGEHOGE__.xlsx')
#ws=wb.get_active_sheet() # ←Warning出ちゃう
ws=wb.active

これだけ.

参考

github.com