How to close Excel files after creation?

I have a workflow to create Excel files from Revit schedules. After creating the files, I want to close them, but can’t figure out to do this from Dynamo.

@gduncan74 did you find a solution to this? i have a similar situation and looking to close specific multiple excel files as a clean up exercise.

No solution on this one yet?

No solution and apparently no research or attempts neither. A sum-up of what could relate to this goal would help this discussion to go further.

I believe that exporting with BumbleBee package will execute Excel in the background, not opening the created spreadsheet. Otherwise the way to achieve this would be to get a list of all running processes, identify the Excel process and then kill it. That should be just a few lines of Python.


Another option I have used is conditions where I want to get Schedule Data out of our Revit into Excel as a table, but not have the Revit user open the excel file directly. Is to export the data to a CSV and then create a Link in the Excel File to read the CSV file as a table. As long as you are writing to a common CSV file any time the Excel is open it can update with the current data. This solution would mean the Revit user would not need to open and/or close the Excel file after running.

1 Like

See this also:

1 Like

This is an older thread, but if you use the OpenXLExportToExcel that simply runs excel in the background.

Note quite. It actually just formats the xlsx file without requiring the excel application be opened at all. The old nodes utilized opening excel (in the background or not) and using the Excel interop API to generate the xlsx file which was problematic as many of the Microsoft updates break those APIs.


Good to know, thanks for the info

1 Like