How can I use win32 in python to get data from an MPP file?

584 Views Asked by At

An MPP file is a Microsoft project file. I will need to scrape the data from the MPP file to sort the MPP files into a folder. So far I have this code to try and achieve that.

def main():
    x = threading.Thread(target=thread_function, args=(1,))
    x.start()
    doc = r"C:\Users\mustafahaque\Code\MPP File Scraping\schedules\17-04-144 COP - Fire Station 193 Apparatus Bay  Addition Precon.mpp"
    mpp = win32com.client.Dispatch("MSProject.Application")
    mpp.FileOpen(doc)
    
    proj = mpp.ActiveProject
    print(proj.BuiltinDocumentProperties(11), ",", proj.BuiltinDocumentProperties(12))
    mpp.FileSave()

This code currently is really messed up. I had to create a thread to automate the error messages that come up from microsoft project (these errors always happen).

How can I go about doing this?

0

There are 0 best solutions below