Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown xlwings error #2415

Open
morooney opened this issue Mar 14, 2024 · 1 comment
Open

Unknown xlwings error #2415

morooney opened this issue Mar 14, 2024 · 1 comment

Comments

@morooney
Copy link

morooney commented Mar 14, 2024

Windows 11 Pro

Versions of xlwings, Excel and Python ( 0.30.10, Office 365, Python 3.10.8)

Describe your issue (incl. Traceback!)

xlwings error

Include a minimal code sample to reproduce the issue (and attach a sample workbook if required!)

def exportToExcelDashboard():
    try:

        with xw.App(visible=False) as app:
            wb = xw.Book(directoryOutput + "/Dashboard - xxx - 2023.xlsb", update_links=False)
            # start and end years
            projectSheet = wb.sheets['projectInfo']
            #clear datasheet ready for new data
            projectSheet.clear_contents()
            #paste data to columns
            projectSheet['a1'].value = 'Variable'
            projectSheet['b1'].value = 'Value'

            # Save and close workbook
            wb.save()
            wb.close()
    except: 
            globals()["tryToOutputToExcelTablesCount"] += 1
            print("Tables not inserted into Excel dashboard ("+str(tryToOutputToExcelTablesCount)+")")
    else: 
        globals()["tryToOutputToExcelTablesCount"] += 1
        print('All outputs printed after ' + str(tryToOutputToExcelTablesCount) + " attempt/attempts")
        globals()["areTablesOutputToExcelVariable"] += 1
    finally:
        print(' ') 

# 1st try
exportToExcelDashboard()

Apologies I can't give much context or a summary of the error, it's very unknown to me, and I'm also unable to replicate, it seems to be a one off issue (it has been working well across several months, including for colleagues with similar code).

Thank you for any ideas :)

@rajmonty
Copy link

Even I am also having similar issue where I am unable to access any kind of excel file using xlwings. The above error is coming everytime I run xlwings.Book

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants