# Insert File/Spreadsheet at once in SQL Table

**URL:** <https://community.n8n.io/t/insert-file-spreadsheet-at-once-in-sql-table/35816>\
**Category:** Questions\
**Tags:** microsoft-sql\
**Created:** [January 24, 2024, 5:43pm UTC](https://community.n8n.io/t/insert-file-spreadsheet-at-once-in-sql-table/35816 "2024-01-24T17:43:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![enzo\_botoloto](https://avatars.discourse-cdn.com/v4/letter/e/d9b06d/32.png) [@enzo\_botoloto](https://community.n8n.io/u/enzo_botoloto)\
**Post date:** [January 24, 2024, 5:43pm UTC](https://community.n8n.io/t/insert-file-spreadsheet-at-once-in-sql-table/35816/1 "2024-01-24T17:43:50Z")

</div>

My workflow currently insert with “Loop Over Items” node about 8000 rows, this takes approximately 50 minutes and is unfeasible for my situation. I guess i can reduce this time inserting the entire file using the function available in SQL for tables, can i do this in the workflow?

---

<div class="post-metadata">

**Author:** ![n8n](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/n8n/32/196425_2.png) [@n8n](https://community.n8n.io/u/n8n)\
**Post date:** [January 24, 2024, 5:43pm UTC](https://community.n8n.io/t/insert-file-spreadsheet-at-once-in-sql-table/35816/2 "2024-01-24T17:43:51Z")

</div>

It looks like your topic is missing some important information. Could you provide the following if applicable.

- **n8n version:**
- **Database (default: SQLite):**
- **n8n EXECUTIONS\_PROCESS setting (default: own, main):**
- **Running n8n via (Docker, npm, n8n cloud, desktop app):**
- **Operating system:**

---

<div class="post-metadata">

**Author:** ![EmeraldHerald](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/emeraldherald/32/35355_2.png) [@EmeraldHerald](https://community.n8n.io/u/EmeraldHerald)\
**Post date:** [January 25, 2024, 11:44am UTC](https://community.n8n.io/t/insert-file-spreadsheet-at-once-in-sql-table/35816/3 "2024-01-25T11:44:41Z")

</div>

Hi @enzo_botoloto 👋

It looks like MSSQL also [supports](https://learn.microsoft.com/en-us/sql/t-sql/functions/base64-encode-transact-sql?view=azuresqldb-current) [base64 encoding](https://stackoverflow.com/questions/56061485/converting-a-mssql-varbinary-to-a-base64-string), so sending over a file should be possible 🤔 While this is focused on postgres, @MutedJam has made a quick overview here:

> [@How to insert a binary file and query it in Postgres?](http://community.n8n.io/t/how-to-insert-a-binary-file-and-query-it-in-postgres/27236/3):
>
> Hi @Jayavel, the exact approach will of course depend on how your incoming data looks like, but assuming you are having a binary item named data coming from your webhook something like below would let you insert a binary file into a bytea column. Table schema Table "public.uploads" Column | Type | Collation | Nullable | Default ------------+-----------------------------+-----------+----------+-----…

That being said, it sounds like you’d likely prefer the option of directly inserting the data in rows, instead of uploading a file? If so, you may need to either create smaller batches, or consider creating a [sub-workflow](https://docs.n8n.io/flow-logic/subworkflows/) that handles processing the data in smaller chunks. If your sub-workflow does all the heavy lifting of processing the data and then only returns a small amount of data back to the main workflow, you should see this speed up 👍 You can see more about this [here](https://docs.n8n.io/hosting/scaling/memory-errors/#reduce-memory-consumption).

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [April 24, 2024, 11:45am UTC](https://community.n8n.io/t/insert-file-spreadsheet-at-once-in-sql-table/35816/4 "2024-04-24T11:45:14Z")

</div>

Closed on April 24, 2024, 11:45am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
