How to Launch Excel

At the end of a workflow, I would like to launch Excel, windows script, batch file, bash script, or any other application. For my purposes, Knime’s work is complete and I want to allow a new app to run and carry on.

I have been able to do this using a python script but seems like overkill to install Anaconda just to do this. In this case I have gotten the name of an Excel file with full path to the Python script node from incoming connected and just opened it.

import os
output_table_1 = input_table_1.copy()
v1 = input_table_1[‘fqFileName’].iloc[0]
os.startfile(v1)

I am not trying to temporarily transfer control or results and get anything back. Just want to launch something.

Seems like there should be an easier way to do this in Knime.

Any input would be appreciated.

Thanks. Marc.

Have you tried external tool node already? https://kni.me/n/SR7Ja-HGIe1FbDaB

I have. The issue I have with that is the ability to pass all the setting as variables. When I look at the variable tab it does not seem like I can pass all of the different custom paths required.

Which settings specifically did not when configured via flow variable?

So, all I would like to do is launch an Excel workbook. (windows OS). Ideally, I would want to pass a fully qualified filename i.e. c:\temp\a.xlsx and just open that file. No further actions required.

I am not seeing all of the variables in the External Tool section on the Launch Settings tab.


image

You might also try the Bash node, with a String Manipulation (Variable) node upstream to cobble together the path, executable, and input file.

4 Likes

Liking that. Do you know if this will work under windows 10? Docs say XP.

It does - you can try it with cmd as suggested in the example.

thx Scott. That looks promising. I will give that a go and report back in to close this thread off.

Still trying to get bash to launch excel?

Have you tried using the CmdwInput node in the same library?

I was able to get Excel to launch by using this command in the Bash node:

cmd /c "C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE"

and unchecking the Propagate stderr to Exception box.

I hadn’t ever tried the CmdwInput node before, but was able to get it to work in the same way by providing the command above as an input string with a Table Creator.

4 Likes

I was missing the cmd /c at the beginning. That was the key.

Because I want to open a specific XL workbook, I just passed the name of the file to open.

cmd /c “C:\temp\a…xlsm”

Thanks so much for your help.

2 Likes

Very strange. I can open Excel by itself but not with file.
cmd /c “C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE File.xlsx”
or cmd /c “C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE” “file.xlsx”
not opens file.
Please advise.

Here is how I have my node configured. I pull the command line and path in from a table column.


Marc.

1 Like

I try to use Bash and it is not working. Also I do not expect result so, did not specify execution directory.

I just tried this in Bash and it worked:

cmd /c start excel "C:\Users\Scott\Desktop\TestTypes.xlsx"

Also a little bit cleaner since the use of the start command means you don’t have to enter the full executable path.

4 Likes

Thank you, @ScottF. It works.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.