Home > Software design >  I want to remove a first text on the cell
I want to remove a first text on the cell

Time:01-25

I want to remove "/input " before the other text. I use this code

else if(text.startsWith("/input")) {
    var sheet = SpreadsheetApp.openById(ssId).getSheetByName("inputan");
    var item = text.split(",");
    sheet.appendRow([date,id,name,item[0],item[1],item[2],item[3]]);
    sendText(id,"Thanks "   name   " data has been recorded");
  }

For the text, I use code

var text = data.message.text;

I have tried to edit 'var text' but the other command come error also I tried to separate the item, but only input number 1 comma 2 comma and 2,3, and 4 entered the table

CodePudding user response:

I want to remove "/input " before the other text

Use String.replace(), like this:

  const text = String(data.message.text).replace(/\/input /i, '');
  • Related