To Upload Large Dataset to Database in n8n

In n8n, I have a webhook that receives an Excel file with around 100,000 rows. I want to insert the data into a PostgreSQL table. Inserting the data row by row or in small batches is very slow.

I know that using Python with the psycopg2 library can insert data much faster. However, the n8n Function node does not support Python or the psycopg2 library.

I installed Python inside the n8n Docker container and I am trying to run a Python script using the Execute Command node. My questions are:

  1. How can my Python script access the Excel file that was uploaded through the webhook?

  2. How can I run this Python script in the fastest way possible from n8n?

Thanks,
It really works.