Last active
November 6, 2024 06:45
Convert MPP to CSV in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This code example demonstrates how to convert MPP to CSV with CSV Options. | |
# Load the input Project file | |
project = tasks.Project("Blank2010.mpp") | |
# CSV options | |
options = tasks.saving.CsvOptions() | |
options.text_delimiter = tasks.saving.CsvTextDelimiter.TAB | |
# Save as CSV | |
project.save("UsingCsvOptions_out.csv", options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This code example demonstrates how to change default view to resource view while converting MPP to CSV. | |
# Load the input Project file | |
project = tasks.Project("Blank2010.mpp") | |
# CSV options | |
options = tasks.saving.CsvOptions() | |
# to change what columns will be exported the DataCategory property can be used | |
# changing the data category from DataCategory.Tasks to DataCategory.Resources | |
options.data_category = tasks.saving.DataCategory.RESOURCES; | |
# Save as CSV | |
project.save("ResourceView.csv", options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This code example demonstrates how to convert MPP to CSV. | |
# Load the input Project file | |
project = tasks.Project("Blank2010.mpp") | |
# Save as CSV | |
project.save("output.csv", tasks.saving.SaveFileFormat.CSV) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This code example demonstrates how to convert MPP to CSV with CSV Options. | |
# Load the input Project file | |
project = tasks.Project("Blank2010.mpp") | |
# CSV options | |
options = tasks.saving.CsvOptions() | |
options.text_delimiter = tasks.saving.CsvTextDelimiter.SEMICOLON | |
# Save as CSV | |
project.save("UsingCsvOptions_out.csv", options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This code example demonstrates how to change delimiter while converting MPP to CSV. | |
# Load the input Project file | |
project = tasks.Project("Blank2010.mpp") | |
# CSV options | |
options = tasks.saving.CsvOptions() | |
# Suppress export of column headers | |
options.include_headers = False | |
# Save as CSV | |
project.save("UsingCsvOptions_out.csv", options) |
Is there an easy way to render specific columns from a project file other than the ones defined in the default views?
you can use the following snippet to customize list of columns exported to CSV:
import aspose.tasks as tsk
l = tsk.License();
l.set_license("license.lic")
# Open existing project
prj = tsk.Project('input.mpp')
columns = []
columns.append(tsk.visualization.GanttChartColumn("Id", 10, tsk.Field.TASK_ID))
columns.append(tsk.visualization.GanttChartColumn("Name", 10, tsk.Field.TASK_NAME))
columns.append(tsk.visualization.GanttChartColumn("COST", 10, tsk.Field.TASK_COST))
csvOption = tsk.saving.CsvOptions()
csvOption.view = tsk.visualization.ProjectView(columns)
prj.save('output.csv', csvOption)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there an easy way to render specific columns from a project file other than the ones defined in the default views?