Skip to main content
Question

VSQL output to excel

  • June 13, 2023
  • 1 reply
  • 2 views

elghali
Forum|alt.badge.img+1

Hello, is it possible to use vsql to output the query result to an excel file?
is it possible to append to an existing file?
is it possible to add sheets to an existing excel file?
is it possible to create an excel file with more than 1 sheet?

1 reply

mosheg
Forum|alt.badge.img+2
  • Participating Frequently
  • June 13, 2023

From Vertica's vsql command-line tool, you cannot directly create an Excel file.
However, you can generate CSV output from Vertica using vsql and then convert that CSV file to an Excel file.
For example:

vsql -F"," -Atc "Your Query;" > Your_file_name.csv

You can also query Vertica from excel after setting up an ODBC DSN.

For example,
1. double click in windows on ODBC_WINDOWS64bit_Vertica-client-xyz.exe
2. Open the ODBC Administrator
(For example, Start > Control Panel > Administrative Tools > Data Sources (ODBC)) --> at system DSN add Vertica
3. Open Excel and from the menu, select Data > Get External Data > From Other Sources > From Microsoft Query.