Convert Microsoft Project MPP file to Excel Formats
Microsoft Project allows the user to export project’s data to formats supported by Microsoft Excel such as ( Spreadsheet2003 XML or XLSX format).
These are steps to export project data to Excel formats:
Suppose you have your project opened in Microsoft Project.
- Select “File\Save As” menu item
- Select location (e.g. “This PC”)
- In “Save As” dialog select ‘Excel Workbook(.xlsx)’ or ‘Excel 97-2003 Workbook (.xls)’ format in “Save as type” drop down.
- Click “Save” button
- In Export Wizard select either “Project Excel Template” to apply default settings or “Selected Data” to customize the output.
If default settings are applied the output Excel Workbook will look as follows:
You can export Microsoft Project MPP file to Microsoft Excel spreadsheet file formats ( Spreadsheet2003 XML or XLSX programmatically using Aspose.Tasks for .NET API. In this case you don’t need to have Microsoft Project installed on your machine.
Convert MS Project MPP files to Spreadsheet2003 XML (Excel 2003)
There are two ways to convert projects to Spreadsheet2003 XML format. The first one is to use SaveFileFormat enumeration. The second one is to use Spreadsheet2003SaveOptions class.
In order to convert a MS Project MPP file to Spreadsheet2003 XML format with default settings using SaveFileFormat:
- Create a new project instance and load the MPP file.
- Convert the project to Spreadsheet2003 XML using Project.Save method and specify the SaveFileFormat.Spreadsheet2003 as the argument.
The following lines of code show how to achieve this in .NET:
1Project project = new Project("New Project.mpp");
2project.Save("SaveProjectDataToSpreadsheet2003XML_out.xml", SaveFileFormat.Spreadsheet2003);
To convert MPP files with a non-default settings the Spreadsheet2003SaveOptions class can be used. With this class one can specify additional options to customize the resulting Spreadsheet2003 XML.
- Create a new project instance and load the MPP file.
- Create an instance of Spreadsheet2003SaveOptions.
- Customize view using properties of Spreadsheet2003SaveOptions class.
- Convert the project to Excel using Project.Save method and pass the Spreadsheet2003SaveOptions instance as the argument.
Presented below is .NET example showing how to use the convert options:
1Project project = new Project("New Project.mpp");
2Spreadsheet2003SaveOptions options = new Spreadsheet2003SaveOptions();
3GanttChartColumn col1 = new GanttChartColumn("WBS", 100, delegate(Task task) { return task.Get(Tsk.WBS); });
4GanttChartColumn col2 = new GanttChartColumn("Name", 100, delegate(Task task) { return task.Get(Tsk.Name); });
5options.View.Columns.Add(col1);
6options.View.Columns.Add(col2);
7project.Save("UsingSpreadsheet2003SaveOptions_out.xml", options);
Convert MS Project MPP files to Excel XSLX (Excel 2007 and later)
The Project class exposes the Save method which is used to save a project in various formats. The Project.Save method allows you to export project tasks, resources and assignments to separate worksheets to Microsoft Excel XLSX format using the SaveFileFormat enumeration type or the XlsxOptions class.
In order to convert MS Project MPP file to XLSX format with default settings using SaveFileFormat:
- Create a new project instance and load the MPP file.
- Convert the project to Excel XLSX using Project.Save method and specify the SaveFileFormat.XLSX as the argument.
The following lines of code show how to achieve this in .NET:
1Project project = new Project("New Project.mpp");
2// convert MPP to Excel
3project.Save("MS Project.xlsx", SaveFileFormat.XLSX);
To convert MPP files with a non-default settings the XlsxOptions class is provided. With this class one can specify additional options to customize the resulting XLSX file.
- Create a new project instance and load the MPP file.
- Create an instance of XlsxOptions.
- Customize view using properties of XlsxOptions class.
- Convert the project to Excel using Project.Save method and pass the XlsxOptions instance as the argument.
Presented below is .NET example showing how to use the options:
1Project project = new Project("New Project.mpp");
2XlsxOptions options = new XlsxOptions();
3// Customize Gantt Chart View
4GanttChartColumn col1 = new GanttChartColumn("WBS", 100, delegate(Task task) { return task.Get(Tsk.WBS); });
5GanttChartColumn col2 = new GanttChartColumn("Name", 100, delegate(Task task) { return task.Get(Tsk.Name); });
6options.View.Columns.Add(col1);
7options.View.Columns.Add(col2);
8// convert MS Project MPP to Excel
9project.Save("MS Project Gantt Chart.xlsx", options);
Converting MS Project MPP file as CSV
In order to learn how to export MS Project MPP file to CSV please read the article.