How can ı send accelerometer data to google sheets

I wanto design a game and ı want to obtain user acceloremeter data when users play game then ı would like to send it to google sheets

Here are two methods....

I am a new user in this program.For the beginning of the game I want to design, I made such a program to send the data from the gyroscope and acceloremeter sensors to google sheet, but it didn't work.

The script will need to know which spreadsheet and which sheet on that spreadsheet to send the data to. Add these two lines to your script:

var ss = SpreadsheetApp.openById('<YOUR SPREADSHEET ID HERE>');
var sh = ss.getSheetByName('<YOUR SHEET NAME>'),

It is not working sir.My blocks are true?Maybe ,there is a something that i need to change

First try sending some sample data, not related to your sensors or sensor events. This will test the script is working. Then you can add the events.

I am not sure if "Shaking" is the best event on which to send data.....(too much / too many changes)

Agree shaking is not viable. I suspect collecting this data directly to a Google Sheet is not possible or practical in real time.

Collect the x, y,z data as a List in real time, then later send List to the Sheet might work. Also posting the data to a Label in real time will provide you with an idea of the format required for the spreadsheet.

Where can i list this constantly changing sensor data outside of the google page?sir
which database or program

Use the tinydb to save to a list

There are various ways. A simple way is to use Blocks like this

to capture the data to a List and post the results to a Label in real time.

Here is a discussion of a very sophisticated Accelerometer app that plots the points from three axes.
Plotting a line graph using canvas - #2 by SteveJG and an aia.