excelscheduled-taskswindows-server-2012

Windows Task Scheduler - Open Excel File "How do you want to open this file"


I'm trying to set up a basic task in the Windows Task Scheduler that opens an Excel file every day. I've done this successfully in the past, but for some reason on the Windows Server 2012 OS I'm using when I try to open the file I get prompted with how do you want to open this type of file?

Task Scheduler Example

Is there a way to automatically select Excel as the program used to run the file for this task?


Solution

  • You need to specify the Full path to the Excel.exe application executable as well as the workbook to open.

    Location of Office Programs (64-bit Office on 64-bit Windows Server 2012)

    For a 32-bit Office version on a 64-bit operating system substitute %PROGRAMFILES(x86)% for %PROGRAMFILES%.

    Example of command line:

    "%PROGRAMFILES%\Microsoft Office\Office14\EXCEL.EXE" "C:\Users\user\Documents\MyWorkbook.xlsx"
    

    To be clear, this means in the Task Scheduler GUI, you need to put the filepath for EXCEL.EXE in the Program/script line and the filepath for the custom Excel file you want to open in the Arguments line.

    Additional command lines options are available to open as read only, etc. See Command-line switches for Excel.