# Bulk row insertin Supabase

**URL:** <https://community.weweb.io/t/bulk-row-insertin-supabase/8666>\
**Category:** Ask us anything\
**Created:** [May 20, 2024, 4:34am UTC](https://community.weweb.io/t/bulk-row-insertin-supabase/8666 "2024-05-20T04:34:50Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sourav](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@Sourav](https://community.weweb.io/u/Sourav)\
**Post date:** [May 20, 2024, 4:34am UTC](https://community.weweb.io/t/bulk-row-insertin-supabase/8666/1 "2024-05-20T04:34:50Z")

</div>

I want to upload bulk rows in a Supabase table using a CSV file from Weweb (using file upload component). That CSV file would contain all the columns exactly the same order the way the columns are in the Supabase table. Will somebody please help me how to do this. My entire project is on hold just for this feature. Kindly help.

---

<div class="post-metadata">

**Author:** ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)\
**Post date:** [May 21, 2024, 3:42pm UTC](https://community.weweb.io/t/bulk-row-insertin-supabase/8666/2 "2024-05-21T15:42:43Z")

</div>

Hi @Sourav 👋

If I understand correctly:

1. you would want the user to be able to upload a CSV
2. you don’t need to store that CSV file in Supabase
3. but you want to update a Supabase table with the rows from that CSV

Is that correct?

In addition, you mention “using a CSV file from Weweb”. Does this mean that you want to store the CSV file in WeWeb’s CDN or is that not important as long as the rows are updated in Supabase?

---

<div class="post-metadata">

**Author:** ![Sourav](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@Sourav](https://community.weweb.io/u/Sourav)\
**Post date:** [May 28, 2024, 7:46am UTC](https://community.weweb.io/t/bulk-row-insertin-supabase/8666/3 "2024-05-28T07:46:55Z")

</div>

Hi Joyce, thanks for replying. Thankfully i managed to resolve the issue. I wanted to upload bulk rows (insert or upsert), just the way we do for single insert in Supabase. I managed to do it with a piece of JS code and Supabase bulk insert option (newly introduced feature). Thanks again for your support. If you want i can share the worflow demo of it with video snapshot in this thread.

---

<div class="post-metadata">

**Author:** ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)\
**Post date:** [May 28, 2024, 2:15pm UTC](https://community.weweb.io/t/bulk-row-insertin-supabase/8666/4 "2024-05-28T14:15:28Z")

</div>

Awesome! Glad you found a solution.

Not sure if you saw but you can do bulk inserts with our no-code workflow action:

 ![CleanShot 2024-05-28 at 16.14.15@2x](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/4/4a20095bf658a3d33dfe4b8430ef306e52a3149c.png)

---

<div class="post-metadata">

**Author:** ![Corner](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@Corner](https://community.weweb.io/u/Corner)\
**Post date:** [May 31, 2024, 1:51pm UTC](https://community.weweb.io/t/bulk-row-insertin-supabase/8666/5 "2024-05-31T13:51:15Z")

</div>

Hi @Sourav, how did you do this ? Would love to see how you managed it

---

<div class="post-metadata">

**Author:** ![Sourav](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@Sourav](https://community.weweb.io/u/Sourav)\
**Post date:** [June 6, 2024, 6:55am UTC](https://community.weweb.io/t/bulk-row-insertin-supabase/8666/7 "2024-06-06T06:55:55Z")

</div>

Hi @Corner,  
Enclosed is the piece of code for your ref. you just need to capture the raw rows of data using CSV file  
and upload component ,post that replace your variable value with the existing one in the code. Hope it will work. Please make sure all the columns in the CSV are in the same order as the DB table.

 ![CSV to JSON](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/7/79c4f98dfc726377b652dc04acca43a738580fe0.png)  
Please let me know for any further query.

---

<div class="post-metadata">

**Author:** ![Corner](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@Corner](https://community.weweb.io/u/Corner)\
**Post date:** [June 10, 2024, 4:11pm UTC](https://community.weweb.io/t/bulk-row-insertin-supabase/8666/8 "2024-06-10T16:11:20Z")

</div>

Thanks a lot @Sourav, i’m gonna check on this and let you know 🙂

---

<div class="post-metadata">

**Author:** ![Corner](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@Corner](https://community.weweb.io/u/Corner)\
**Post date:** [June 11, 2024, 8:17am UTC](https://community.weweb.io/t/bulk-row-insertin-supabase/8666/9 "2024-06-11T08:17:53Z")

</div>

Is this technique working with a csv file ? Or should I first put a js script to parse the doc, then make an object of the parsed data and then multiple insert ? Thanks

---

<div class="post-metadata">

**Author:** ![Sourav](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@Sourav](https://community.weweb.io/u/Sourav)\
**Post date:** [June 19, 2024, 9:57am UTC](https://community.weweb.io/t/bulk-row-insertin-supabase/8666/10 "2024-06-19T09:57:08Z")

</div>

> [@Corner](#):
>
> Or should I first put a js script to parse the doc, then make an object of the parsed data and then multiple insert

Hi @Joyce,  
“Or should I first put a js script to parse the doc, then make an object of the parsed data and then multiple insert”

Yes what you have described, this is the exact way this workflow works, but the piece of JS code will make the uploaded object exactly the way SB receive multiple rows to insert or upsert. To make it work we just need to declare the variable in this JS code post capturing the CSV file within upload element.

---

<div class="post-metadata">

**Author:** ![Corner](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@Corner](https://community.weweb.io/u/Corner)\
**Post date:** [July 3, 2024, 2:50pm UTC](https://community.weweb.io/t/bulk-row-insertin-supabase/8666/11 "2024-07-03T14:50:32Z")

</div>

Thanks @Sourav for your reply. I will try to do this on my own, but as it seems a bit technical I may need some help further haha

---

<div class="post-metadata">

**Author:** ![Corner](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@Corner](https://community.weweb.io/u/Corner)\
**Post date:** [July 5, 2024, 3:50pm UTC](https://community.weweb.io/t/bulk-row-insertin-supabase/8666/12 "2024-07-05T15:50:01Z")

</div>

@Sourav @Joyce little question. My client gave me this xls document :

 ![Capture d'écran 2024-07-05 171705](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/7/7f62a0a2af9cc691cf2bba44f59a466deff3ead4.png)

It’s like a summary of customers (“Groupe X”) who have subsidiaries (“Alliance Colmar” for example) and sales with suppliers (“Initial” for example).

Do you think it’s possible to populate a Supabase table with it ? Problem is, it’s not like one table with different columns, but rather a lot of different sheet within one table …

---

<div class="post-metadata">

**Author:** ![Sourav](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@Sourav](https://community.weweb.io/u/Sourav)\
**Post date:** [July 14, 2024, 2:50pm UTC](https://community.weweb.io/t/bulk-row-insertin-supabase/8666/13 "2024-07-14T14:50:59Z")

</div>

I don’t think it is possible, as Supabase doesn’t support this way. Instead you can join the columns horizontally, before that you need split the sheet into three and use transpose function. As this should be  
done programmatical, i am suggesting you to have a look on this. [PostgreSQL: Documentation](https://www.postgresql.org/docs/)

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [July 14, 2024, 4:39pm UTC](https://community.weweb.io/t/bulk-row-insertin-supabase/8666/14 "2024-07-14T16:39:37Z")

</div>

Hello, this is doable, but would require some JavaScript (for data manipulation), if you’d need it, let me know and we can arrange something. Otherwise I’d suggest simplifying your file and it should work.

---

<div class="post-metadata">

**Author:** ![Corner](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@Corner](https://community.weweb.io/u/Corner)\
**Post date:** [July 15, 2024, 3:11pm UTC](https://community.weweb.io/t/bulk-row-insertin-supabase/8666/15 "2024-07-15T15:11:41Z")

</div>

Hello guys, thanks for the answer. I managed to make my client change his work document as this is not even safe to work only on sheets (they didn’t have any db so far). So basically, the app I’m working on will become the place to register any data ! No more need to import data as they will insert it directly 🙂

---

<div class="post-metadata">

**Author:** ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)\
**Post date:** [July 15, 2024, 4:01pm UTC](https://community.weweb.io/t/bulk-row-insertin-supabase/8666/16 "2024-07-15T16:01:10Z")

</div>

Beautiful! Congrats on convincing your client to tweak their work habits. I’m sure it will save them (and you 😅) loads of time and headaches in the long run!
