Can we load Excel (.xlsx or .xls) file directly to Vertica Table?

haroonharoon Registered User

Currently to load Excel (.xlsx or .xls) file to my Vertica Table I have to convert Excel file to CSV and then load it to Vertica Table using Copy query.

Is there any way that i can be able to load Excel (.xlsx or .xls) directly to Vertica without converting it to CSV?

Any kind of help will be appreciated.


  • Jim_KnicelyJim_Knicely Administrator, Moderator, Employee, Registered User, VerticaExpert

    Yes, you have to convert them.

    I use xlsx2csv to convert Excel files to CSV in Linux.



    [[email protected] dbadmin]# easy_install xlsx2csv
    Searching for xlsx2csv
    Best match: xlsx2csv 0.7.4
    Processing xlsx2csv-0.7.4.tar.gz
    Writing /tmp/easy_install-CnIxQW/xlsx2csv-0.7.4/setup.cfg
    Running xlsx2csv-0.7.4/ -q bdist_egg --dist-dir /tmp/easy_install-CnIxQW/xlsx2csv-0.7.4/egg-dist-tmp-pbf5cn
    zip_safe flag not set; analyzing archive contents...
    Moving xlsx2csv-0.7.4-py2.7.egg to /usr/local/lib/python2.7/site-packages
    Adding xlsx2csv 0.7.4 to easy-install.pth file
    Installing xlsx2csv script to /usr/local/bin
    Installed /usr/local/lib/python2.7/site-packages/xlsx2csv-0.7.4-py2.7.egg
    Processing dependencies for xlsx2csv
    Finished processing dependencies for xlsx2csv
    [[email protected] dbadmin]# exit
    [[email protected] ~]$ file ExcelFile.xlsx
    ExcelFile.xlsx: Microsoft Excel 2007+
    [[email protected] ~]$ xlsx2csv ExcelFile.xlsx ExcelFile.csv
    [[email protected] ~]$ cat ExcelFile.csv
    [[email protected] ~]$ xlsx2csv ExcelFile.xlsx ExcelFile.csv; cat ExcelFile.csv | vsql -c "COPY test FROM stdin SKIP 1 DELIMITER ',';"
    [[email protected] ~]$ vsql -c "SELECT * FROM test;"
    col1 | col2 |        col3
        1 | ABC  | 2012-09-19 00:00:00
        2 | XYZ  | 2012-05-04 00:00:00
    (2 rows)
  • haroonharoon Registered User
    edited March 6

    I am using openpyxl to convert .xlsx to csv and pyexcel to convert .xls to pyexcel

    What are your reviews about both these packages?

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file