Convert MPP to Excel using Java

Convert MPP to Excel using Java

An MPP file is a project created by Microsoft Project. It allows organizing, tracking, and maintaining projects.  It contains tasks, resources, assignments, timeline, budget, and different other project-related information. We can easily export project data from MPP files to Excel spreadsheets (XLSX) programmatically in Java. In this article, we will learn how to convert MPP to Excel using Java.

The following topics shall be covered in this article:

Java API to Convert MPP to Excel

For converting MPP files to Excel, we will be using the Aspose.Tasks for Java API. It allows creating, editing, or manipulating Microsoft Project files programmatically in Java applications. Please either download the JAR of the API or add the following pom.xml configuration in a Maven-based Java application.

<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java API</name>
    <url>http://repository.aspose.com/repo/</url>
</repository>
<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-tasks</artifactId>
    <version>22.4</version>
    <classifier>jdk18</classifier>
</dependency>

Convert MPP to Excel in Java

We can convert the MPP file to an Excel file by following the steps given below:

  1. Firstly, load the MPP file using the Project class.
  2. Finally, call the save() method to save as XLSX. It takes the output file path and SaveFileFormat as arguments.

The following code sample shows how to convert MPP to Excel using Java.

Convert MPP to Excel in Java.
Convert MPP to Excel in Java.

Convert MPP to Excel with Advanced Options

We can also apply various settings while converting the MPP file to Excel. For this purpose, the API provides the XlsxOptions class that allows specifying additional options when rendering project pages to XLSX. We can specify XLSX save options by following the steps given below:

  1. Firstly, load the MPP file using the Project class.
  2. Next, create an instance of the XlsxOptions class.
  3. After that, set various options such as PageSize, Encoding, ResourceView, AssignmentView, etc.
  4. Finally, call the save() method to save as XLSX. It takes the output file path and SaveOptions as arguments.

The following code sample shows how to convert MPP to XLSX with advanced options using Java.

Get a Free License

You can get a free temporary license to try the library without evaluation limitations.

Conclusion

In this article, we have learned how to:

  • save MS Project data as an XLSX file in Java;
  • set various options to export data from MPP to Excel programmatically.

Besides, you can learn more about Aspose.Tasks for Java API using the documentation. In case of any ambiguity, please feel free to contact us on the forum.

See Also