Ask Your Question

How do I run a batch file from a Calc spreadsheet? [closed]

asked 2014-06-28 17:18:44 +0200

Lew Merrick gravatar image

updated 2015-09-02 22:47:36 +0200

Alex Kemp gravatar image

CALC -- I am running version of Libre Office. I want to run a batch file (with 2 arguments) from within a Calc spreadsheet. I was assuming that this can be done with the hyperlink command, but apparently is cannot. Can anybody here advise me as to how to make this work?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-27 10:50:40.510215


bencomp -- Is there a more "detailed" manual for LO-BASIC? What background I have in programming deals more with FORTH and C -- and that is many years ago. (I was a whiz in programming CP/M, DOS, and even RX-01 systems.) I do not seem to be able to get the SHELL() command to work. ???

Lew Merrick gravatar imageLew Merrick ( 2014-07-20 22:13:21 +0200 )edit

Have you followed the link in the answer? I understand not understanding something can be frustrating, but try to show what you did to solve this problem, not what background you have as it doesn't help understanding your problem. seems to be the starting point for Basic.

bencomp gravatar imagebencomp ( 2014-07-20 22:49:15 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2014-06-28 19:25:09 +0200

Lupp gravatar image

updated 2014-06-29 22:33:26 +0200

Running an executable (.BAT possible) by clicking a hyperlink calculated by HYPERLINK(): You have to know the full (absolute path) on your system. Then it will work.

Passing parameters: I don't know a way. And there shouldn't be one. (I also did a bit of research in that direction.)

Speaking of Windows: A standard installation uses well know paths for its system executables many of which can be called by any user. Think of one pretty dangerous (killing a lot of files ...). The executable just sarted and nothing else shouldn't do much harm. Working with parameters it might ruin everything. I think I'm better off if nobody can bait me with a hidden URL() of that kind anchored to a sweet piece of text.

[begin EDIT]

As any sufficiently powerful programming system Star(LibreOffice)Basic is providing means for executing program calls including those taking parameters. The Function of choice is named SHELL() and will return an error code (0 if no error). Cf The hint concerning ConvertToURL seems to be of no meaning under Win 8.

But there are issues in specific with calling CMD.exe .

You may use a tiny helper function I "programmed" . It is included in the attached example.

ask36180ShellExperiments001.ods [end EDIT]

[begin EDIT2] Much more clear and self-explanatory. ask36180ShellExperiments002.ods [end EDIT2]

edit flag offensive delete link more


I have this rather large set of databases that are comprised of rather large (30+ MB) CAD data files. If I store them in a 7z file, a set of 195 part files compresses to about 200 MB. What I am trying to do is to walk the designer through selecting the appropriate CAD part file, extract it from the 7z archive, and activate it in the CAD system. The batch file works from the command line. I do know that the path to the 7z executable ("C:\Program Files\7-Zip\7z") needs to be enclosed by quotation marks. So do the arguments. However, when I run it from the hyperlink command, I get an error message (""J:\Lews_Data\Designs\Alibre_Standards\Sprockets\ANSI Sprockets\ExtractFile"" is not an absolute URL that can be passed to an external application to open it.) -- ExtractFile is the name of the batch file.

Lew Merrick gravatar imageLew Merrick ( 2014-06-29 00:16:59 +0200 )edit

Have you tried adding ".bat" to the script name? It may be invisible in Windows Explorer but still be part of the file name.

bencomp gravatar imagebencomp ( 2014-07-20 22:50:11 +0200 )edit

Question Tools



Asked: 2014-06-28 17:18:44 +0200

Seen: 1,827 times

Last updated: Jun 29 '14