How to send data to Google Sheets with Google App Scripting

  • Hi, I have done a game previously that sends the player's name and score to a Google sheet via Google app scripting, using the tutorial shared by dop2000.

    Everything worked and still works. So I followed the same steps to create another game, but faced the 'CORS-policy' problem when submitting data.

    I've tried both GET and POST methods over AJAX but still faced the same error.

    Is there a workaround to this, or are there any alternative methods to send data to a Google sheet (client requirement)?

    Tagged:

  • Hi,

    Are you referring to this tutorial?

    construct.net/en/tutorials/sending-data-construct-23-1447

    I just used this, and it is working, able to submit to Google sheets.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi,

    Are you referring to this tutorial?

    https://www.construct.net/en/tutorials/sending-data-construct-23-1447

    I just used this, and it is working, able to submit to Google sheets.

    Yes, this tutorial. It worked wonderfully on my previous 2 games, but not on this current game I'm building, which is weird.

    The only difference is that for this current game:

    1) I'm sending over more parameters than the previous (working) games

    2) I also do another AJAX call to load a local JSON file for this current game

    Sorry if my description is rather vague, not really well-versed in coding :(

  • Can you try sending data from the current project to the spreadsheet used in your previous game (the one that's working)? If you are able to send data, then the issue is likely with the new spreadsheet/script. Maybe you missed a step and didn't grant some permission.

  • Can you try sending data from the current project to the spreadsheet used in your previous game (the one that's working)? If you are able to send data, then the issue is likely with the new spreadsheet/script. Maybe you missed a step and didn't grant some permission.

    Thanks for the tip! I tried using the working-game spreadsheet and it worked on my current game.

    After trying to eliminate many possible causes, what I found out was because I was using the same variable name on both Construct and Google script (e.g. using "n" for the name variable on both Construct and Google script). When I changed the variable on Google script, everything worked out fine.

    Btw, I'm using POST instead of GET method. Will this be better in terms of security?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)