Python Forum
I must be missing something simple?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I must be missing something simple?
#1
To start - I am a novice at Python.
I have a created a "tool" I use for my work daily. It includes the ability to create Excel workbooks that I use for notes etc. I am updating this tool by simply adding the ability to create update and show a third excel workbook. The first two work well and have for years. This new third (createQstn) gives me an tkinter attribute error that "worksheet has no attribute 'save'". However I am defining it as "Workbook()". The "filepath3" variable works for every other function that uses it, AND if I create the workbook in excel and save it correctly, I will get my print response "exists" when I hit my "createQstn" button. The only issue is that it will not create this workbook and gives me the error, if it does not already exist. The two previous functions create workbooks without error, and I can't see what I may have done different. Any help would be much appreciated. I am including the code section that produces the error. If it is possible the issue is earlier or later somehow, please let me know and I will post the full code.

def createQstn():
    print(filepath3)
    isFile = os.path.isfile(filepath3)
    if isFile == False:
        QstnsWB = Workbook()
        QstnsWB = QstnsWB.active
        QstnsWB['A1'] = '#'
        QstnsWB['B1'] = 'Date'
        QstnsWB['C1'] = 'Question'
        QstnsWB['D1'] = 'Answer'
        QstnsWB['E1'] = 'Done'
        QstnsWB.save(filepath3)
        print("created")
    print("exists")
the error:
Error:
Exception in Tkinter callback Traceback (most recent call last): File "C:\Program Files\Lib\tkinter\__init__.py", line 1948, in __call__ return self.func(*args) ^^^^^^^^^^^^^^^^ File "C:\Users\SeanL\Python Scripts\360Helper5.0.py", line 102, in createQstn QstnsWB.save(filepath3) ^^^^^^^^^^^^ AttributeError: 'Worksheet' object has no attribute 'save'
Thanks for any help.
Sean
Reply


Messages In This Thread
I must be missing something simple? - by SLFrey - Dec-10-2023, 06:34 PM
RE: I must be missing something simple? - by SLFrey - Dec-11-2023, 03:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Not able to crack a simple visualization – missing something basic – plz guide darpInd 4 2,939 Mar-27-2020, 09:26 AM
Last Post: darpInd

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020