There is a Google script, a webhuk connected with a telegram bot. I wanted the code for one typed forward and two subsequent replicas to fill in a row in the google table, but I ran into the problem that the script responds to each message in the bot and processes them separately.

var contents = JSON.parse(e.postData.contents); var text = contents.message.text var txtar = text.split(" "); var sheetName = "Тест"; var sheet = SpreadsheetApp.openById(ssId); sheet.getSheetByName(sheetName).appendRow([maintext[3], "-", maintext[2], maintext[1], "-", maintext[0]]); 

Thus, the script fills the table, but it outputs each processed message to a new line. Can I use a key, for example, to supplement an already filled line (you can use the forward time of the first message as a key). If the editing of already affected lines is possible, then by what method it is feasible, only the setCurrentCell(cell) method found in the SpreadsheetApp class manuals, but it is not very convenient to use.

  • You must ask a specific question. This is not an exact answer. - oshliaer
  • @oshliaer, the question was in the method for a class or other solution to the filling problem in several passes. You gave him the answer, thank you. - Dareten 9:59 pm

1 answer 1

setCurrentCell not only inconvenient, but also impossible, since The table has no Active characteristics when executing such a script.

In this case, you need to make entries line by line, transforming them later, so as not to force Telegram to wait for a response.

For example,

 | UID | KEY | VALUE | |-----|-------|--------| | 1 | step1 | Привет | | 1 | step2 | Купить | | 2 | step1 | Привет | | 1 | step3 | Пока | | 3 | step1 | Привет | 

And, already proceeding from this data, to build the table extended to the right.