Home > Net >  google apps script open new document
google apps script open new document

Time:11-26

hi want to create a google document and add to the value of the variable which is. Why can't I pass it to a document with this function?

var doc=DocumentApp.create("Wynik"); 
doc.getBody().appendParagraph(arr[wasitfound]);

error code: "Exception: The parameters (number[]) don't match the method signature for DocumentApp.Body.appendParagraph."

CodePudding user response:

Check the documentation for appendParagraph.

It accepts a string but you are passing an array.

Example:

var str = "Hello";
doc.getBody().appendParagraph(str)

or use join:

doc.getBody().appendParagraph(arr[wasitfound].join())
  • Related