Sending data to a specific cell in google sheets

Hi all,
I try do make a small app for our sports club. We want to check in the people when they come for training. I am looking for a solution to send data to a specific cell in a google spreadsheet. But I don't get it.



I tried with different blocks and i also asked chat gpt for solutions, but I am too dumb. I hope there is someone out there to help me.

Best regards from Hamburg

Markus

You are using a doPost, the web app expects a POST from the client, so try POSTText...

Are you using a number for col (not a letter, e.g. 2 not B) ? I see you are.

1 Like

Hi TIMAI2,
thank you for your idea. I think I tried that block earlier and it also didn't work. I will try again later. May be the problem is on site of Google. I tried to use the manual in this community for activating and deploying the script. But it looked different.

Best regards

Markus

I have tested your script and it works OK for me.

function doPost(e) {
  var ss = SpreadsheetApp.openById('<SheetID here>');
  var sh = ss.getSheetByName('Sheet1');
  var params = e.parameter;
  
  var row = parseInt(params.row);
  var col = parseInt(params.col);
  var val = params.value;

  sh.getRange(row,col).setValue(val);

  return ContentService.createTextOutput("value set");
  
}

Hello TIMAI2,
i tried again... and again I failed...

1.) I opened a new sheet

2.) Extensions -> Apps Script

There is an error message at the bottom, when I try to run it!

3.) I deploy it


4.) I create a new App in MIT App Inventor 2

Am I doing anything wrong here?
The "web1.Url" is the link that I copied from the deployment

5.) I try to send a value to Cell B2

But nothing happens in the sheet. And everything looks fine to me, but it isn't! :sob:

It is not that easy as it seems to be (for me)

Best regards

Markus

P.S.: when you ever visit Hamburg I will take you out for one or two beers!

image

image

should be &col=

1 Like

Also your error when running:

image

should be SpreadsheetApp.openById

1 Like

I have it!!!! Thank you!!!

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