Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save HoriLiu/18b85c21cb6884e6b5169cad0f7f70a9 to your computer and use it in GitHub Desktop.
Save HoriLiu/18b85c21cb6884e6b5169cad0f7f70a9 to your computer and use it in GitHub Desktop.

Revisions

  1. HoriLiu revised this gist Jun 15, 2024. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion test_mpxj_from_MS_Project2003_To_Excel_use_python.py
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,9 @@
    import mpxj
    import pandas as pd

    jpype.startJVM("-Dlog4j2.loggerContextFactory=org.apache.logging.log4j.simple.SimpleLoggerContextFactory")
    #Ref FAQ for log4j2 in https://www.mpxj.org/faq/
    jpype.startJVM("-Dlog4j2.loggerContextFactory=org.apache.logging.log4j.simple.SimpleLoggerContextFactory")

    #Ref https://pypi.org/project/mpxj/
    from net.sf.mpxj.reader import UniversalProjectReader
    project = UniversalProjectReader().read('example.mpp')
  2. HoriLiu revised this gist Jun 15, 2024. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions test_mpxj_from_MS_Project2003_To_Excel_use_python.py
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,8 @@
    import pandas as pd

    jpype.startJVM("-Dlog4j2.loggerContextFactory=org.apache.logging.log4j.simple.SimpleLoggerContextFactory")
    #Ref FAQ for log4j2 in https://www.mpxj.org/faq/
    #Ref https://pypi.org/project/mpxj/
    from net.sf.mpxj.reader import UniversalProjectReader
    project = UniversalProjectReader().read('example.mpp')

  3. HoriLiu renamed this gist Jun 15, 2024. 1 changed file with 0 additions and 0 deletions.
  4. HoriLiu revised this gist Jun 15, 2024. No changes.
  5. HoriLiu revised this gist Jun 15, 2024. 1 changed file with 25 additions and 1 deletion.
    26 changes: 25 additions & 1 deletion test_mpxj_from_MS_Project2003_To_Excel_use_python
    Original file line number Diff line number Diff line change
    @@ -1 +1,25 @@
    ‎‎​
    import jpype
    import mpxj
    import pandas as pd

    jpype.startJVM("-Dlog4j2.loggerContextFactory=org.apache.logging.log4j.simple.SimpleLoggerContextFactory")
    from net.sf.mpxj.reader import UniversalProjectReader
    project = UniversalProjectReader().read('example.mpp')

    # Extract relevant data
    data = []
    print("Tasks")
    for task in project.getTasks():
    if(task.getName()):
    print(task.getID().toString() + "\t" + task.getName())
    data.append([task.getID().toString(), task.getName(), task.getDuration(), task.getStart(), task.getFinish()])
    else:
    print(task.getID().toString() + "\t" + "Null")
    data.append([task.getID().toString()])

    df = pd.DataFrame(data, columns=['ID', 'TaskName', 'WorkDuration', 'StartDate', 'EndDate'])

    # Save the data to Excel
    df.to_excel('WbsEst.xlsx', index=False)

    jpype.shutdownJVM()
  6. HoriLiu created this gist Jun 15, 2024.
    1 change: 1 addition & 0 deletions test_mpxj_from_MS_Project2003_To_Excel_use_python
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    ‎‎​