Invoke Power Shell and excelcnv.exe

I am trying to get excelcnv working with Invoke Power Shell.
excelcnv works fine from the cmd function in Windows.
I can tell the excelcnv is being invoked ok because if I rename something in the path I get an error message.
I get no error message when I run the bot - just the bot runs then stops. No change to the file.
I suspect I am not putting in the parameters in correctly.
In the Input Parameters section I have three variables:

  • one for the command swtiches
  • one for the path to file to be converted
  • one for the path to the output file

What else should I be doing?

Hi @Nigel_Barrett

Could you maybe create a sample project for other users to have a look? It would make your issue more visual and hopefully allow others to assist better.

Try to use dummy data and simplest workflow that recreates the issue. Try to also mention your version of Studio and activity packages :slight_smile:

If you run the following command from the cmd prompt:
“C:\Program Files\Microsoft Office\root\Office16\excelcnv.exe” -oice "C:\Data\myfile.xls” "C:\Data\myfile.xlsx”
it will make a copy and convert the file from xls to xlsx.

As I say I can get this to work manually in the cmd prompt. I can also get it to work in VBA. I wanted to invoke the command using the Invoke Power Shell activity.

See attached file. I have added three parameters to the input. The command line switches; the input file; and the output file.

You will note that double quotes are important when you input this from the cmd manually. I tried to replicate this in the parameters. I tried several combinations of double quotes.ExcelCnv.xaml (6.6 KB)

Hi @Nigel_Barrett,
Can you show your attributes you are using for Invoke Powershell activity?

Hi @Pablito
I do not know what you mean by ‘attributes’.
The input has "C:\Program Files\Microsoft Office\root\Office16\excelcnv.exe” as the CommandText.
Then there is a collection of parameters:
-oice
"C:\Data\myfile.xls”
"C:\Data\myfile.xlsx”

I mean the right pane with all settings for the activity.

There is a file you can download in the previous posting.

Please try this:
image
Anyway you are only starting application with use of PowerShell. You can try to use also Start Process activity. It allows you to use arguments there.

Many thanks Pablito, the second suggestion worked.
The first suggestion did not accept the string as a script.
You have saved me the task of opening the file in Excel and saving as xlsx.

2 Likes

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