Search code examples
pythonxlwings

Complete file path of multiple Excel workbooks with Python


I have multiple Excel workbooks open on my computer, which are in different instances. I am using the following script to get the complete path of all the files.

With below code I can get only a list of file names. How can I get the full path?

import xlwings as xw
wb = xw.books
print (wb)

Solution

  • Each Book object has a fullname property:

    import xlwings
    
    workbooks = xlwings.books
    for workbook in workbooks:
        print(workbook.fullname)