Insert an Excel file in PostgreSql

0

I am looking for information on how to insert an Excel file in PostgreSql, but I can not find information, there is no guide or tutorial from scratch, all are concrete problems on the internet.

My intention is for the client (Angular2) to send an excel to the server (SpringBoot) and save the data of the excell in the Database (postgreSQL).

I need a code to start or something, but I can not find where to start.

Thank you.

    
asked by EduBw 12.07.2018 в 11:48
source

2 answers

1

Analyzing your question you can use as a reference r2dbc-postgresql .

  • Know the concept of Maven and the way you access repositories.
  • Choose an IDE to implement the practice.
  • answered by 23.08.2018 в 19:24
    0

    I'm not familiar with sprint-boot, but the most efficient way to put an excel in postgres, to my liking, is to use ogr2ogr , an extension that installs with the library GDAL .

    The installation in Ubuntu (do not say that you use OS) is done with:

    sudo add-apt-repository -y ppa:ubuntugis/ppa
    sudo apt update 
    sudo apt install gdal-bin
    

    With that installed you can do:

    ogr2ogr -f PostgreSQL PG:"host=localhost user=postgres dbname=geoexamples" archivo.xlsx
    

    Or convert it to a SQL:

    ogr2ogr -f PGDump archivo.xlsx
    

    GDAL has bindings for java:

    You apparently need to install both according to this Stack Overflow response . With that you could run ogr2ogr from your program, but otherwise you always have the option to run it by instantiating a thread cmdLine .

        
    answered by 12.07.2018 в 15:16