When I executed the below code, I received a warning that reads " DeprecationWarning: Call to deprecated function get_sheet_by_name (Use wb[sheetname])." To avoid receiving the warning and execute the code properly, how do I need to fix the code?? Please help.
import openpyxl
wb=openpyxl.load_workbook('example.xlsx')
wb.get_sheet_names()
Use
wb.sheetnames
instead of
wb.get_sheet_names()
and use
wb["Sheet1"]
instead of
wb.get_sheet_by_name('Sheet1')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With