DEV Community

Cover image for Submitting Custom form data to Google sheets via React Js

Submitting Custom form data to Google sheets via React Js

Segun Tuase on March 14, 2022

In this article we will be discussing how to receive custom form data through React JS, often times when we need to do this we always have to pass ...
Collapse
 
preshpi profile image
Precious Egwuenu

Hey, Mine is saying this.

Access to XMLHttpRequest at 'script.google.com/macros/s/AKfycby...' from origin 'localhost:3020' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Collapse
 
shehjad_dev profile image
Shehjad Ali

I didn't understand from the part - "We then proceed to Extensions β†’ App Scripts then copy this code into the ". What are we doing here?

Collapse
 
tuasegun profile image
Segun Tuase

You’re trying to create a script on google sheets that collates data

Collapse
 
anatugreen profile image
Anaturuchi

Thanks for this. If you are here and you having a problem with this, you can check this video I made about it: Video

Collapse
 
lilyntalmers profile image
lilyntalmers

Hey @tuasegun I tried but it's not sending data to my google spreadsheet. Do I need to put the spreadsheet id in the Apps Script? Also, can you please share a repository as a working example?

Collapse
 
tuasegun profile image
Segun Tuase

Hello, do you still need help with this. I could schedule a meeting with you.

Collapse
 
darshan_v profile image
Darshan V

yes i need

Thread Thread
 
tuasegun profile image
Segun Tuase

Shoot me a google meet on tuase360@gmail.com

Collapse
 
haitham_ali_886731305fd56 profile image
Haitham Ali

THANK YOU. Worked first try. Nothing happened in the webpage (obviously) but the data popped up in the sheet. Now to display the thank you message and disable the form after submit.

Collapse
 
jduncan06 profile image
Jduncan06

I have used this in one of my projects and it worked great, but I tried to use it in a different project and it is not transferring my data

Collapse
 
stevelgtm profile image
Ε tefan HadbavnΓ½

If somebody will help this. When it is not working for you just run function initialSetup() at first.

Collapse
 
zlvzlv profile image
Zilvinaskli

I'm getting 401 response and cors error. Is there a workaround for that?

Collapse
 
devcreed profile image
Edun Elijah • Edited

Awesome πŸ‘Œ πŸ‘

The code that was pasted in the App script, is it a ready-made function?

Collapse
 
tuasegun profile image
Segun Tuase

Yes, something like that

Collapse
 
irishgeoff10 profile image
Geoff
Collapse
 
kushdesai45 profile image
kushdesai45

its not working for me
It shows nothing in the sheer