["<!DOCTYPE"] error shows when i run my application

link of application :- http://ai2.appinventor.mit.edu/#5535214956052480

Export your .aia file and upload it here.

SMS_App.aia (3.9 KB)

Your problem is in your Google Sheets code, at


Here's all I know about Google Sheets:

until an expert comes along.

what type of error occur in google script

@TimAI2 is the expert on this.
I can't seem to find the Pass The Buck icon.

@TIMAI2 please elobrate problem on my google script

You can save a step by copying the script and posting it here.
We can't see it from the link.

P.S. Copying the responseContent into a Label.Text before trying to parse it will also help diagnose the problem. Of course, show us it all.

We need to see your google apps script and an example of the data in your google sheet. Let us assume for now that your google sheet has only one sheet, and it is called Sheet1.


const SHEET_URL = "https://docs.google.com/spreadsheets/d/1Muil84Q3BZ0ICsd7c2HVmPpwLed7khhDVbPGOuMnI_0/edit#gid=0";
const SHEET_NAME = "SMS";

const doGet = () => {
    const sheet = SpreadsheetApp.openByUrl(SHEET_URL).getSheetByName(SHEET_NAME);
    const [header, ...data] = sheet.getDataRange().getDisplayValues();

    const PHONE = header.indexOf('Phone');
    const TEXT = header.indexOf('Text');
    const STATUS = header.indexOf('Status');

    const output = [];

    data.forEach((row, index) => {
        if (row[STATUS] === '') {
          output.push([index + 1, row[PHONE], row[TEXT]]);

    const json = JSON.stringify(output);

    return ContentService.createTextOutput(json).setMimeType(ContentService.MimeType.TEXT);

const doPost = (e) => {
    const sheet = SpreadsheetApp.openByUrl(SHEET_URL).getSheetByName(SHEET_NAME);
    const [header] = sheet.getRange("A1:1").getValues();
    const STATUS = header.indexOf("Status");
    var rowId = Number(e.parameter.row);
    sheet.getRange(rowId + 1, STATUS + 1).setValue('SMS Sent');
    return ContentService.createTextOutput('').setMimeType(ContentService.MimeType.TEXT);

@TIMAI2 plz elobrate problem

Looks like you are following this guide from Amit Agarwal:

I suggest you return to this and work through the guide, comparing this with what you have done, until you find and fix your errors.

i have done this last 8-10 times with this blog and video both

Confirm that your script is published as "you" the google account owner, and is accessible to "Anyone" (NOT "Anyone with a google account")
If you have made any changes to the script, publish a new version.
If you are using the new script editor, compare the latest script url with the one in your app.

1 Like

The App Inventor codes and Script are correct. The errors can be in the direction of the Script, of the Spreadsheet or what @TIMAI2 has indicated.

When the information is sent by SMS, the "Status" field is filled with 'SMS Sent'. In the following 'Fetch Message' none of those with 'SMS sent' appear.

BTW, nice code, nice app.

This method is the good one for making the [“<!DOCTYPE”] error to disappear.