I am trying to insert data from excel file into project file i.e .mpp file. Following code works fine while putting data into simple cells (example cost column) in .mpp file.
import openpyxl
import win32com.client
file = 'PATH_TO_PROJECT_FILE'
project_app = win32com.client.Dispatch('MSProject.Application')
project_app.Visible = 1
project_app.FileOpen(file)
project = project_app.ActiveProject
project_tasks = project.Tasks
file_path = 'PATH_TO_EXCEL_FILE'
file = openpyxl.load_workbook(file_path,keep_vba=True)
sheet3 = file['OutputData']
for cell,task in zip(sheet3['D'][1:],project_tasks):
if '=' in str(cell.value):
break
task.Cost = cell.value
But in .mpp file, cells of duration column have spinners/spin buttons to set number of days. see picture below:
If I use the same code as above to set/insert value of duration using python, it does not change the value, moreover it does not throw any exception and the program exit in normal fashion
Same is the case with start date in project. see the picture below:
A solution came to my mind but it does not seem feasible. If I create a custom column and insert duration and start date into it. But the draw back of this solution is that the visuals in MS Project files are dependent on previously default columns.
How can I set/insert values into these type of cells? Or if there is anything I can do in MS Project? Or there's any solution using vba?

