Dynamo Logic, write and read from the same EXCEL file at the same time


Attached is a Script I’ve built that writes a number (JHK_Line Number) to EXCEL, that performs a VLOOKUP off a table on a second page to populate fabrication info back to the parts in Revit.

Currently, the script needs to be run twice consecutively to work. What’s happening when Dynamo is “Processing” it doesn’t write the data to EXCEL until the script has finished, so the VLOOKUP data isn’t populated on the first execution. This method has a Thread.Pause before reading from EXCEL, but it doesn’t matter as Dynamo hasn’t finished, EXCEL isn’t populated.

Is there a way to control the read/write separately on the same script? I don’t want it to be a two part interaction. It seems I need to tell Dynamo to finish Excel.WriteToFile before attempting to read it, but I don’t have control of that.

Moving the pause to AFTER Excel.ReadfromFile you can literally see the lists are blank until Dynamo has fully completed once.

(The .DYN file will be useless for most as it relies on numerous parameters in place in Revit, and a custom .XLSX file with filled out Line data/NDE requirements. (Part of our fab process working strictly on piping systems.) but at least it’ll give visual reference to what’s going on, and the time of execution for the 2 processes. It also requires selected parts prompted from Dynamo and selected out of Revit.

Perhaps slinging your data via flux.io would get the job done.

Hi @Jason_Parker ,

you should try this between your “write” and “read” nodes :

The transaction nodes help manage the order of the operations. Dynamo will run the script twice in one run.
I am not sure I’m using them in the best possible way… but I think they are the key to your issue.


I tried inserting the Transaction start stops, but I’m hoping I don’t have them in the right order, or something, as it’s still requiring to be run twice. The EXCEL file still remains blank until the script 100% processes.


try this – > MASTER-JHK_LINE-INFO_V3.0 edited.dyn (47.4 KB)

it’s a slightly edited version of your script. I hope it works as you want.


@Mostafa_El_Ayoubi This works perfectly! THANK YOU SO MUCH!!!

Looking at what you changed here, it appears you made the write complete and built off the data side of the EXCEL.Write.

It didn’t even cross my mind the output DATA was the same list as what was written to Excel!!!

I implemented this logic on another one of our big scripts, I just wanted to post again thanks @Mostafa_El_Ayoubi this was a huge help I couldn’t, for the life of me, understand how to correct!

At first I didn’t understand why the File.path got added to the list, then instead of copy/pasting over what I had, I rebuilt your logic and it makes total sense now. Keeps the data flow linear instead of 2 separate processes running at the same time.

Thanks again!

You’re most welcom @Jason_Parker . Glad I could help :slight_smile: