Woops, I missed the file extension in the last line:
/* Function: openFileInOSDefault
Open file in the operating system default program
Include this once at the top of your script
Arguments:
filepath - local path file
*/
openFileInOSDefault = Function({filepath},
If( Host is( "Windows" ),
Run Program(
Executable( "PowerShell.exe" ),
Options(
Eval Insert( "\[-Command "& {Start-Process '^filepath^'}"]\" )
),
Read function( "text" )
);
,
RunProgram(
Executable( "/usr/bin/open" ),
Options( filepath ),
ReadFunction( "text" )
)
);
);
//Now in your script you can just call the function
openFileInOSDefault("C:\Users\Me\Desktop\test.xlsx")