Crear nuevo Doc en Google Drive después de procesar el archivo de texto cargado

Subí exitosamente un archivo de texto a Google Drive y escribí un método que traduce exitosamente el texto a pig latin. ahora estoy intentando crear un nuevo documento en Google Drive para generar el texto traducido. Sin embargo, siempre recibo el mensaje: "Ocurrió un error" y cuando reviso mi unidad, solo tengo el texto original cargado.

Aquí está mi código:

function doGet(e) {

 var app = UiApp.createApplication().setTitle("Upload");
   var formContent = app.createVerticalPanel();
   formContent.add(app.createFileUpload().setName('thefile'));
   formContent.add(app.createSubmitButton('submit'));
   var form = app.createFormPanel();
   form.add(formContent);
   app.add(form);
   return app;
 }

function doPost(e) {
   // data returned is a blob for FileUpload widget
   var fileBlob = e.parameter.thefile;
   var doc = DocsList.createFile(fileBlob);

   var app = UiApp.getActiveApplication();
   //Display a confirmation message
   var label = app.createLabel('file uploaded successfully');
   app.add(label);
   return app;

  var text = doc.getDataAsString();
  Logger.log('I uploaded and my text is: ' + text);

  MakeTranslationDoc(text);
 }

function MakeTranslationDoc(passedText) 
{ 

  // Create a new Report 
  var newdoc = DocumentApp.create('Pig Latin Translation');

  newdoc.appendParagraph(ParseText(passedText));

  // Save and close the document
  newdoc.saveAndClose();
}

function ParseText(myText) 
{  
  ...convert text to piglatin...
  return results;
}

¿Qué debo hacer para crear correctamente el nuevo documento a partir del texto cargado?

Respuestas a la pregunta(2)

Su respuesta a la pregunta