ActivePresenter Saola Animate Pricing Download

How can I export results to an Google Doc

#1

Hi

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

(Dao Viet Phuong) #2

Hi,

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

Regards,

#3

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

(Toan Le) #4

Hi,

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

Regards

#5

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

(Toan Le) #6

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

#7

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

(Scott) #8

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

(Nam Nguyen) #9

Hi Scott,

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

Regards,