0

i'm new to google app script trying to make a telegram bot to googlesheet.

case :

i successfuly make a script which can add data to telegram app to google sheet (by certain command)

inputting data from telegram

here's the data in google sheet

however i need the bot to reply me with a google sheet generated code (in row A, "FPB261222-1") after 3 second maybe.. for user to track the status.

what is the script?

1 Answers1

-1

I check some solutions from here and make a one for myself. This function find a last row in column A on your sheet and then get a cell value. I call sheet by name, you can change it to current list or ID.

function test() {
  const sh = ss.getSheetByName('YourSheetName');
  const lrow = sh.getLastRow();
  const Avals = sh.getRange("A1:A"+lrow).getValues();
  const Alast  = lrow - Avals.reverse().findIndex(c=>c[0]!='');
  const Alastvalue = sh.getRange(`A${Alast}`).getValues();
  Logger.log(Alastvalue);
}

And you can sent it to the bot with:

sendText(Id, Alastvalue);
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 29 '22 at 17:10