How can I export results to an Google Doc

Hi

How can I export the results on eLearning of my students to an excel spreadsheet
Thanks

Hi,

Please follow this tutorial https://atomisystems.com/elearning/send-quiz-report-google-sheets-email/

Regards,

Thanks, but as soon as I paste the code I get an error message

Hi,

The code in the tutorial is formatted incorrectly. Please clone the sample Google sheet as described in the following post:

Regards

Hi, Sorry to bother again, I cloned your sample on the Google Sheets, copied your script and pasted into my sheet.

I have changed the script to:

var TO_ADDRESS = “office@ahcrotating.com”; // Email to receive the report data
function doPost(e) {
try {
var report = JSON.parse(e.parameter.report);

// Insert report data to Google Sheets
var doc     = SpreadsheetApp.getActiveSpreadsheet();
var sheet   = doc.getSheets()[0]; // get the first sheet
var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];
var nextRow = sheet.getLastRow()+1; // get next row
var row     = [ new Date() ];
// loop through the header columns
for (var i = 1; i < headers.length; i++) { // start at 1 to avoid Timestamp column
  if(headers[i].length > 0) {
    row.push(report[headers[i]]); // add data to row
  }
}
sheet.getRange(nextRow, 1, 1, row.length).setValues([row]);

// Send report data via email
MailApp.sendEmail({
  to: TO_ADDRESS,
  subject: "Report Data" + " - " + report.Name,
  htmlBody: JSON.stringify(report)
});

return ContentService    // return json success results
      .createTextOutput(
        JSON.stringify({"result":"success",
                        "data": JSON.stringify(report) }))
      .setMimeType(ContentService.MimeType.JSON);

} catch(error) { // if error return this
Logger.log(error);
return ContentService
.createTextOutput(JSON.stringify({“result”:“error”, “error”: e}))
.setMimeType(ContentService.MimeType.JSON);
}
}

Got to the next step and copied the link. Pasted into my Active Presenter quiz, saved, run the quiz, could add my name but then got an error message.

2

I am not sure what I am doing wrong.

Thanks for your help.

Kind regards
Heiltjie

Hi,

Please make sure that:

  • Options are selected correctly when creating the web app
    report
  • The app URL is copied/pasted correctly

If the error still persists, please open the web browser developer tools (press F12) to see if there’s any error messages in the Console tab.

Regards

Thank you - it is working!!!:grin:

Hi Toan,

Can this be method be adapted to send (via email) the results of a survey with Likert and essay type questions?

Thanks kindly,
Scott

Hi Scott,

Both send email and send data to Google Docs functions work for all kinds of questions.

Regards,

Hi Nam,

I made a survey with a single Likert question and an essay response. I was able to get it to work using a cloned version of the sample Google Sheet pasted earlier in the thread. Unfortunately, this Google Sheet contains information I do not need and I wanted to cut it down to the bare essentials. The only fields I need to display are “Date,” “User ID,” Rating Scale (Likert) Learner Response," and “Text Box Learner Response.” the last two fields are found in the details field. Is it possible to create a Google Sheet only containing the fields I listed? I attached a copy of the Google Sheet for reference. If you need anything else, please let me know.

https://docs.google.com/spreadsheets/d/1HLlZOrNIEdce8cS8vczCn9u5B_AeiaOoueRJZ892cUk/edit?usp=sharing

Thank you,
James

Hi James,

Please check my answer in this thread Google Sheet Survey Results Question.

Regards,