Print Thread
How to save output to excel file (.xlsx) from command line
#64181 08/26/22 07:46 AM
Joined: Dec 2005
Posts: 2,004
Roima Denmark
Member
OP Offline
Member
Joined: Dec 2005
Posts: 2,004
Roima Denmark
I need to execute an SQL and save the result in an Excel file (.xlsx) using an automated command line.
Is this possible or is the only option to save the result as text files using the command line options csv= or tsv= ?

Re: How to save output to excel file (.xlsx) from command line
Claus Pedersen #64183 08/26/22 09:17 AM
Joined: Aug 1999
Posts: 22,249
Member
Offline
Member
Joined: Aug 1999
Posts: 22,249
This is currently not possible for Excel. I have added this to the list of enhancement requests.


Marco Kalter
Allround Automations
Re: How to save output to excel file (.xlsx) from command line
Claus Pedersen #64187 08/26/22 09:57 AM
Joined: Dec 2005
Posts: 2,004
Roima Denmark
Member
OP Offline
Member
Joined: Dec 2005
Posts: 2,004
Roima Denmark
Actually, I found out that using the command line option excel=myfile.xlsx, Query Reporter generates and saves an excel file, but it still insists on opening the file.
On that particular machine where I am running the command, there is no excel installed, so I set up Windows to use Notepad to open excel files. Then Notepad opens the zipped .xlsx file, but as I am running the whole thing in an task scheduler job, the entire session closes down after finishing the command, so the Notepad instance is also closed.
But it would still be nice to have the option not to open excel after creating the file.


Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.208s Queries: 14 (0.066s) Memory: 2.5026 MB (Peak: 3.0396 MB) Data Comp: Off Server Time: 2024-07-17 13:17:00 UTC
Valid HTML 5 and Valid CSS