Here, we will show you an example where data in a spreadsheet is loaded into a database:
- If your spreadsheet data is neatly laid out in a single worksheet, as shown in the following screenshot, then you can go to File | Save As and then select CSV as the file type to be saved:
- This will export the current worksheet to a file, like the following:
"Key","Value" 1,"c" 2,"d"
- We can then load it into an existing PostgreSQL table, using the following psql command:
postgres=# \COPY sample FROM sample.csv CSV HEADERpostgres=# SELECT * FROM sample; key | value-----+------- 1 | c 2 | d
- Alternatively, from the command line, this ...