Out[21]: <bound method Workbook.close of <openpyxl.workbook.workbook.Workbook object at 0x0000023790378748>>

Hi,

I am getting below message in my console. Code is running without any issues.
But am not able to understand this message, is it an error.
Can anyone please help me in this.

Out[21]: <bound method Workbook.close of <openpyxl.workbook.workbook.Workbook object at 0x0000023790378748>>

import openpyxl

wbkName = r’\AA\AA\AA\AA\Python Chart Data.xlsx’

wbk = openpyxl.load_workbook(wbkName)

for wks in wbk.worksheets:

for myRow in range(1, 10):

for myCol in range(1,10):

wks.cell(row=myRow, column=myCol).value = myRow + myCol

wbk.save(wbkName)

wbk.close

You forgot to call the method:

wbk.close()

The parentheses (round brackets) are needed to actually call the method.
Otherwise you’re just asking Python to evaluate the method as an object,
without calling it, and in the console that will print the message you
see.

1 Like

Hi @steven.daprano , thanks a lot for the help. It worked. Have a nice day ahead. :slight_smile: