Appscript google docs error script function not found: createArticle

13 Views Asked by At

The actual function is create article, but the execution log says createAricle()??? Here's the code:

function createArticle() {
  var num` = 0;`
  var body = DocumentApp.getActiveDocument().getBody();
  var article = body.getText().match(/TestTheTool|Article#|Article #|Article #/gim);
  
  if (article !== null) {
    for (var t of article) {
      num += 1;
    }
    
    var par1 = body.appendParagraph("Story #" + num + " ) None");
    var par2 = body.appendParagraph('By Pusheen');
    
    par1.setHeading(DocumentApp.ParagraphHeading.HEADING1);
    par1.setAlignment(DocumentApp.HorizontalAlignment.CENTER);
    par2.setAlignment(DocumentApp.HorizontalAlignment.CENTER);
  }
}

I even asked AI, and it didn't work. This function is supposed to guess which "article" number it is, but instead, it just shows some random error for no reason! Please try to help me. I can't seem to get the hang of this. I'm still a beginner appscripter.

0

There are 0 best solutions below