Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8919473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:02:10+00:00 2026-06-15T06:02:10+00:00

I am trying to create a script that takes google form information, creates a

  • 0

I am trying to create a script that takes google form information, creates a new spreadsheet, imports that data into new spreadsheet to do calculation and make a chart, then email a PDF of that sheet to the Form User.

I thought I was getting close, but ran into an issue.
The data imports over to the new spreadsheet, but the data does not show up in the PDF in my e-mail. Why?

//Template Info
  var docTemplate = "myssID";

  var docName = "MotionControlReport";

function formSubmitCreate(e) {

  //Variables

  var userOrientation = e.values[1];
  var userStroke = e.values[2];
  var userStrokeUnits = e.values[3];
  var userName = e.values[11];
  var userCompany = e.values[12];
  var userEmail = e.values[13];
  var userPhone = e.values[14];
        
  //Template Info
  var copyId = DocsList.getFileById(docTemplate).makeCopy(docName+' for '+userName).getId();
  var copyDoc = SpreadsheetApp.openById(copyId);
  var copyBody = copyDoc.getActiveSheet();
  
  copyBody.getRange(1, 1).setValue(userName);
  copyBody.getRange(1, 2).setValue(userCompany);
  copyBody.getRange(1, 3).setValue(userEmail);
  copyBody.getRange(1, 4).setValue(userPhone);
  copyBody.getRange(1, 5).setValue(userOrientation);
  copyBody.getRange(1, 6).setValue(userStroke);
  copyBody.getRange(2, 6).setValue(userStrokeUnits);
  
  //Save as PDF and send e-mail
  var pdf = DocsList.getFileById(copyId).getAs("application/pdf");
  var subject = "Motion Control Report";
  var body = userName + ",  Thank you very much for using our online Linear Motion Sizing Tool.";
  MailApp.sendEmail(userEmail, subject, body, {htmlBody: body, attachments: pdf});
  //Deletes temporary Document
  DocsList.getFileById(copyId).setTrashed(true);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:02:11+00:00Added an answer on June 15, 2026 at 6:02 am

    You forgot to flush your Spreadsheet and data is saved from cache a little bit later than it is converted to PDF.
    I checked your code (with flushing) and it works well and mails correct data in PDF from form for me.

    SpreadsheetApp().flush()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a simple script in Google App Script that takes information
I was trying to create a Google Apps Script, that takes attachment of e-mails,
I'm trying to create a script that takes a .txt file with multiple lines
I'm trying to create a Python script that would : Look into the folder
I'm trying to create a script that takes two parameters: a word and a
I am trying to create a script that takes in a string with an
I'm trying to create a script that when run against a DB takes a
I am trying to create a script that will take a Google Doc template
I am trying to create a script that takes a $$variable and adds them
I'm trying to create a script with GD library that will take an uploaded

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.