title: Is it possible to run google app script to submit a html form from website to google sheet on mobile browser?
body: <p>I am now trying to create a form block for user to input info and submit files.</p>
  <p>I use Google Sheet with Google Apps Script when I test it, everything works fine when I test it on desktop browser, but never work on mobile browser of Chrome IOS, and Safari.</p>
  <p>Could anyone give me some hints how to make the <code>doPost()</code> method work on mobile browser.</p>
  <p>Here is my script from Google Apps Script:</p>
  <pre><code>var emailTo= &quot;420@gmail.com&quot;
  var REDIRECT_URL = &quot;/successful&quot;;
  
  function doPost(e) {
  
  try {
  var data = e.parameter.fileContent;
  var filename = e.parameter.filename;
  var email = e.parameter.email;
  var name = e.parameter.name;
  var result=uploadFileToGoogleDrive(data,filename,name,email,e);
  return redirect();
  } catch(error) { // if error return this
  Logger.log(error);
  return ContentService
  .createTextOutput(JSON.stringify({&quot;result&quot;:&quot;error&quot;, &quot;error&quot;: error}))
  .setMimeType(ContentService.MimeType.JSON);
  }
  }
  
  // new property service GLOBAL
  var SCRIPT_PROP = PropertiesService.getScriptProperties();
  // see: https://developers.google.com/apps-script/reference/properties/
  
  /**
  * select the sheet
  */
  function setup() {
  var doc = SpreadsheetApp.getActiveSpreadsheet();
  SCRIPT_PROP.setProperty(&quot;key&quot;, doc.getId());
  }
  
  /**
  * record_data inserts the data received from the html form submission
  * e is the data received from the POST
  */
  
  function record_data(e,fileUrl) {
  try {
  var doc = SpreadsheetApp.openById(SCRIPT_PROP.getProperty(&quot;key&quot;));
  var sheet = doc.getSheetByName('test'); // select the responses sheet
  
  var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];
  var nextRow = sheet.getLastRow()+1; // get next row
  var row = [ new Date() ]; // first element in the row should always be a timestamp
  // loop through the header columns
  for (var i = 1; i &lt; headers.length; i++) { // start at 1 to avoid Timestamp column
  
  if(headers[i].length &gt; 0 &amp;&amp; headers[i] == &quot;photo-link&quot;) {
  row.push(fileUrl); // add data to row
  }
  else if(headers[i].length &gt; 0) {
  row.push(e.parameter[headers[i]]); // add data to row
  }
  }
  // more efficient to set values as [][] array than individually
  sheet.getRange(nextRow, 1, 1, row.length).setValues([row]);
  }
  catch(error) {
  Logger.log(e);
  }
  finally {
  return;
  }
  
  }
  
  function uploadFileToGoogleDrive(data, file, name, email,e) {
  try {
  var dropbox = &quot;Shop-Clients-Pics&quot;;
  var folder, folders = DriveApp.getFoldersByName(dropbox);
  
  if (folders.hasNext()) {
  folder = folders.next();
  } else {
  folder = DriveApp.createFolder(dropbox);
  }
  
  var contentType = data.substring(5,data.indexOf(';')),
  bytes = Utilities.base64Decode(data.substr(data.indexOf('base64,')+7)),
  blob = Utilities.newBlob(bytes, contentType, file);
  var file = folder.createFolder([name, email].join(&quot;-&quot;)).createFile(blob);
  
  var fileUrl=file.getUrl();
  
  //Generating Email Body
  var html =
  '&lt;body&gt;' +
  '&lt;h2&gt; Test Auto Send Email &lt;/h2&gt;' +
  '&lt;p&gt;Name : '+e.parameters.name+'&lt;/p&gt;' +
  '&lt;p&gt;Email : '+e.parameters.email+'&lt;/p&gt;' +
  '&lt;p&gt;Contact : '+e.parameters.contact+'&lt;/p&gt;' +
  '&lt;p&gt;Address : '+e.parameters.address+'&lt;/p&gt;' +
  '&lt;p&gt;LinkedIn Url : '+e.parameters.linkedinUrl+'&lt;/p&gt;' +
  '&lt;p&gt;File Name : '+e.parameters.filename+'&lt;/p&gt;' +
  '&lt;p&gt;&lt;a href='+file.getUrl()+'&gt;Resume Link&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;' +
  '&lt;/body&gt;';
  
  record_data(e,fileUrl);
  
  MailApp.sendEmail(emailTo, &quot;Test Auto Send Email322&quot;,&quot;Test Auto Send Email Recieved322&quot;,{htmlBody:html});
  return file.getUrl();
  } catch (f) {
  return ContentService // return json success results
  .createTextOutput(
  JSON.stringify({&quot;result&quot;:&quot;file upload failed&quot;,
  &quot;data&quot;: JSON.stringify(f) }))
  .setMimeType(ContentService.MimeType.JSON);
  }
  }
  function redirect() {
    return HtmlService.createHtmlOutput(
      &quot;&lt;script&gt;window.top.location.href=\&quot;&quot; + REDIRECT_URL + &quot;\&quot;;&lt;/script&gt;&quot;
    ); 
  }
  </code></pre>
  <p>For More Info: My function of submitting the file:</p>
  <pre><code>function UploadFile() {
  var reader = new FileReader();
  var file = document.getElementById('attach').files[0];
  reader.onload = function(){
  document.getElementById('fileContent').value=reader.result;
  document.getElementById('filename').value=file.name;
  document.getElementById('uploadForm').submit();
  }
  reader.readAsDataURL(file);
  }
  </code></pre>
  <p>I got an error when I use Chrome mobile:</p>
  <blockquote>
  <p>LOG TransportError: There was an error during the transport or processing of this request. Error code = 7, Path = /wardeninit</p>
  </blockquote>