in reply to Module for intelligently analyzing and merging spreadsheet data

PostgreSQL has (as a contrib module) file_fdw (fdw=Foreign Data Wrapper) which reads csv (readonly; it cannot write to the csv file). It offers the postgres SQL-interface to address the data in the text files.

Steps are:

1) Installing the file_fdw module ('create extension file_fdw') (once)

2) Creating a server [1] ('create server if not exists csvserver foreign data wrapper file_fdw') (once)

3) Construct a CREATE FOREIGN TABLE statement [2] to reflect the structure of the csv file. The csv-file header line can often be used to convert into such an CREATE statement (possibly even adding the data type to columns).

SQL calls to such a 'Foreign Table' now read the underlying csv file(s) (select * from mytable).

Advantages: SQL access to csv data.

Disadvantages: Needs Postgres. Readonly. No indexing possible, so that huge csv-files can make it slow (alhough 'copying' onto a materialized view [3] on the foreign table makes indexing possible). Filesystem access for the postgres superuser is necessary .

[1] Create Server

[2] Create Foreign Table

[3] Create Materialized View