I have an excel workbook in which there is data from multiple text files.
The text files are created in a .bat script.
I would like to refresh the workbook in the script right after creating the files.
Does anyone know a command that can do that?
Thanks!
12 Answers
For command line refresh (scheduled by Windows task scheduler) I ended up using this open source application: . Note that Excel needs to be installed on client for this to work.
You can specify what to update, for example "macros", "pivot tables", "Queries" or simply "all".
Together with this nice tool "WasFile" from you can check the age to avoid unnecessary excel-refreshes.
For example, a batch file:
set file1="c:\Tmp\refreshMe.xlsx"
ECHO.
echo ----- %File1% -----------------------------
C:\Test\WasFile.exe %file1% modified not after today-1
if %errorlevel%==0 (echo TRUE: Older than
Goto Next1
)
if %errorlevel%==1 (
echo FALSE: Not older
goto Skip1
)
if %errorlevel%==255 (
Echo ERROR
goto Error
)
:Next1
Echo ### Update START ....
C:\test\ExcelRefresh.exe -d -a -f %file1%
Echo ### Update END ....
echo. I don't think excel has CLI, but you can use VBS - there is example of importing data from excel spreadsheet using vbs: but it's possible to do this in reverse direction too.