Start dynamo script from excel

To make it somewhat easier to follow, I will share what I did: I Read from File the sheet 3 that is currently empty, and the If node check this with == to let the file path string pass or not to another Read from File node that reads the final data I want to update

1 Like

That was a thought I had as well, but it’s all way beyond my knowledge of Python. You’d probably need to access the Excel API.

i will try to figure something generic… that can be used in cases not only for excel.

my ideas is something with combining a list that needs to be filled so i can send another lidt (as the current method). Then test if value of the first list is correct and then pass the other list.

I know that DS can do that kind of evaluation, but i cant write the complete code sitting in my couch using my tablet without any programming tools and dynamo on it :slight_smile:

1 Like

hahaha…same thing here. Have a nice weekend !
We’ll figure it out soon.

1 Like

Have you tried using the bumblebee package? This should be easy to do with it. You can read and write to an actively open workbook and all you’d have to do is toggle a bool node and re-run the graph.

I have tried with ReadExcel.ByRange and could not make it work, but Read Excel would work indeed. I still believe that a popup to click on when you are done with the edition of the spreadsheet in Excel would be efficient and simple, because the graph is then frozen until you click. This popup could maybe return the needed boolean value :slightly_smiling_face:

@d.kelfkens, @Nick_Boyts, @Yna_Db and everyone else interested :slight_smile:
I have now tried to make a ‘WaitFor’ node, there actually is waiting. However, I could need some help to get it tested before I add the node to my package. Place the ‘WaitFor.dyf’ file in the same folder as your graph, then it should be readable.

The ‘var’ input is the input that needs to be passed.
The ‘waitFor’ input is whatever data that needs to be computed before the ‘var’ input is transferred to the output ‘var’.

I deleted the node, since the solution was not the need for a ‘complicated’ node, but…

Try this in a codeblock:

@JacobSmall problem mentioned was that data wasnt finished before the data was send… your method would not secure that

in my node am i testing the same input at two different times and compare if they are equal… if that is the case, then pass

Ah, I thought it was a different issue. Good script now that I understand the use. Out of curiosity, what happens if a user gets stuck mid-excel update?

Also you may want to consider a different name - DanEDU.WaitForExternalUpdate as one idea. Calling it DanEDU.WaitFor is what lead me to ask “Why is there some much effort here when one code block will make it work as it?”

Test on my side wasn’t successful: the data still pass through, even if the result of the function to wait for is null, but I assume this is not the way intended to use this node. It would be nice to see an example.
To all useful ends, this followed the post I mentioned earlier:

Just to mention it also, AutoHotkey, that was mentioned in the post below, can apparently also create scripts which can be used to launch programs, open documents, etc.

Another one that could be useful:

And here is how to control Dynamo from the command line which let “control and automate the running of Dynamo graphs”:

It might not be simple to solve after all… so maybe we need to accept that a human factor has to be the thing that pass data… so no need to update the DanEDU package or give the node a better name :slight_smile:
So for now is the message button or the true/false toggling the solution :slight_smile:

Simply closing the Excel spreadsheet would be an interaction anyway and could reveal itself to be quickly ennoying. But I am totally convinced there could still be lots of good things to do with Excel, especially because of the possible interaction with Python. My intent was only to try to sum up the existing possibilities before the development of a new one :grinning:

I’ve created a small Python script that might be what I’m looking for.
Strange thing is that it works fine when I open Excel manually and let the script run.
When I open an Excel file with a python script and then let it continue to my Wait for Excel script it doens’t seem to work.Test - 11.dyn (1.9 KB)

@d.kelfkens, @Nick_Boyts, @Yna_Db
I think I have figured why it went wrong with the waitFor trick


It seems to be so, that there is a computational direction in a graph!
I was doing another graph when I noticed that it had huge impact where I placed the code block containing the ‘waitFor’. I went back to my old graphs and saw that where mine worked, they where always placed lower and/or right positioned in a graph…

That sounds so wrong it might be right…

Who wants to experiment with a series of time consuming nodes like list.permutations, a Python script to write the time the Python node receives input, and a wait for node to cause the sequence to run in and out of order?

I thought that I was crazy…

So I tried once more this morning to reproduce the error… and the first run failed if I moved the “waitFor” block, but in the subsequent run, it succeeded.

Last night I did many things and revised many graphs, so maybe was the memory filled up (dynamo is not the best in memory management). Maybe could that be an explanation?

In theory, should the trick with “waitFor” always work, but that has been questioned, so I am just trying it figure out what could be a reasonable explanation.

I will post if I can catch the moment where it fails if I experience something similar again.

at the next run it failled!?



Your goal is to do an asynchronous operation:

  1. pause the main thread execution
  2. create a new thread that raises an event to check if a certain field in the active excel workbook has been populated
  3. get an answer and process it
  4. If false, continue stalling the main thread and raise a new event. Else if true, merge the worker thread and continue the main execution.

Technically it might be possible to do this through a python script but I don’t really see the benefit of doing so and putting so much effort into it for something this simple.

1 Like

Last night I even tried to pause the thread, it still failed. The only thing that not failed was position of the waithFor code block!?

I have never experienced this error before, and only because @Yna_Db wrote that he could create an error using the “waitFor” trick I have been testing it, and even tried to write a node for this (is removed now).

There is something wrong with memory management in dynamo.