This example demonstrates how to upload and process CSV and Excel files using NpgsqlRest upload handlers.
- Cookie-based authentication (alice/bob)
- CSV file upload with row-by-row processing
- Excel file upload with sheet and row processing
- Stores row data as PostgreSQL text arrays
The CSV handler parses each row and calls a row command for processing:
row_command = select example_7.csv_upload_row($1,$2,$3,$4)$1= row index (int)$2= row data (text[])$3= previous result (for chaining)$4= metadata (json) containing file info and user_id
The Excel handler works similarly but includes sheet information:
row_command = select example_7.excel_upload_row($1,$2,$3,$4)- Metadata includes
sheetproperty with the sheet name all_sheets = trueprocesses all sheets in the workbook
sql_7/V1__example_7_schema.sql- Schema, tables, and typessql_7/R__example_7_login.sql- Login functionsql_7/R__example_7_logout.sql- Logout functionsql_7/R__example_7_csv_upload.sql- CSV upload endpointsql_7/R__example_7_csv_upload_row.sql- CSV row processorsql_7/R__example_7_excel_upload.sql- Excel upload endpointsql_7/R__example_7_excel_upload_row.sql- Excel row processorconfig.json- NpgsqlRest configurationpublic/index.html- Web UI
- Run migrations to create schema
- Start NpgsqlRest with this config
- Login as alice (password123) or bob (password456)
- Upload CSV or Excel files