I want to create a file with google AppMaker using DriveApp. First i have created a String with the content of my file and then i use
var file = DriveApp.createFile("file.scl",content,MimeType.PLAIN_TEXT);
All content is generated like that
var content = "";
content = content + "First line \r\n";
content = content + "Second line \r\n";
content = content + "End";
The problem is when i open the created file the word "undefined" is added to the start of the first line. The content of the file:
undefinedFirst line
Second line
End
I have tried to remove the extension (.scl), replace with another extension, create a blob, change the MimeType, remove special char like "\r\n" but the "undefined" does not want to leave.
I d'ont know when and why this "undefined" is added to the file and i did not find any issue on the web.
Anyone have a suggestion ?
thanks.
I found the solution. My final content string is a concatenation of many string and one string was not initialized as a string. ( Yes, just that)
I have just add << = "" >> to make << var aString = "";>>