Excel – Execute external program in ruby and wait for its execution

excelexternalruby

How do I start an external program (like an excel sheet) from ruby and wait for its execution resp. termination before continuing.

I know I can start the excel sheet with

system 'start excel "my/path/to/the/sheet"' 

but using this will only start the sheet and then continues.

Best Answer

The problem you are having is not with Ruby but the start command, this launches another program and returns immediately. You need to make that command wait for excel to finish using the wait flag:

system('start /wait excel "my/path/to/the/sheet"')