Forum Discussion
exporting variables to be read in a Google docs spreadsheet
I've seen Tom's helpful screencast on how to embed a Google docs form into a Storyline project. However, what I want to do is a little different. I'd like to be able to export the values of about a dozen variables from Storyline so I could see them in a spreadsheet the way I would if students entered those values into a Google docs form.
I've got a grammar assessment, and I want to export a student's name and either OK/NEED TO REVIEW/MIGHT WANT TO REVIEW for each of a dozen or so topics. Now, I could just use a final page screen in Storyline showing a student her status on these dozen topics and ask her to fill out an embedded Google docs form in which she basically copies the results manually. These are just initial assessment scores, and I'm not worried about honesty issues. However, this seems like a pretty klutzy way to do things. Would anyone be able to help me out with a suggestion for a better method? I don't know any JavaScript, and my familiarity with Storyline is fairly low.
Thanks!
Dorothy
- LauraBrunningCommunity Member
Hi,
I appreciate this was a while ago, but wondered if anyone can help.
I can get the variables to pass to the google spreadsheet, but I too am seeing the pop up error/message from website. Although it does let you close this message and carry on with the course (and the variables go onto the spreadsheet) - I'm struggling to get rid of it.
Can any one help??
Cheers, Laura
PS - Exported as SCORM running in VLE where the users have to use IE 11 (created in SL1)
PPS - should also have said that just using the scripts nicked from these forums without alterations except to add my spreadsheet/form and variable details (thank you!).
SCRIPT used in Google:
function myFunction() {
var SCRIPT_PROP = PropertiesService.getScriptProperties();
function doGet(e){
return handleResponse(e);
}
function doPost(e){
return handleResponse(e);
}
function handleResponse(e) {
var lock = LockService.getPublicLock();
lock.waitLock(30000);
try {
var doc = SpreadsheetApp.openById(SCRIPT_PROP.getProperty("1EMJiuiqZ7R8tX9MbeSrjrKEjgGfhw16LfLAYQ1_bOaY"));
var sheet = doc.getSheetByName(SHEET_NAME);
var headRow = e.parameter.header_row || 1;
var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];
var nextRow = sheet.getLastRow()+1; // get next row
var row = [];
for (i in headers){
if (headers[i] == "Timestamp"){ // special case if you include a 'Timestamp' column
row.push(new Date());
} else { // else use header name to get data
row.push(e.parameter[headers[i]]);
}
}
sheet.getRange(nextRow, 1, 1, row.length).setValues([row]);
return ContentService
.createTextOutput(JSON.stringify({"result":"success", "row": nextRow}))
.setMimeType(ContentService.MimeType.JSON);
} catch(e){
return ContentService
.createTextOutput(JSON.stringify({"result":"error", "error": e}))
.setMimeType(ContentService.MimeType.JSON);
} finally {
lock.releaseLock();
}
}
function setup() {
var doc = SpreadsheetApp.getActiveSpreadsheet();
SCRIPT_PROP.setProperty("1EMJiuiqZ7R8tX9MbeSrjrKEjgGfhw16LfLAYQ1_bOaY", doc.getId());
} }SCRIPT USED IN STORYLINE
var player = GetPlayer();
$.ajax({
url: "https://docs.google.com/forms/d/1SzbvgcnV93aqOfHU4ycIlrJhD2BH4PpanB039l7Wgao/formResponse",
type: "POST",
data: {"entry.174521765" :player.GetVar("name"), "entry.1135805308":player.GetVar("id"), "entry.1806056227" :player.GetVar("colour")},
success: function(data)
{
alert(data);
}
});
return false;
THING ADDED TO STORY.HTML <HEAD>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
It works, the variable data gets filled into the Google sheet, it just brings up the error message attached - the user can close the error message and carry on as normal, it's just not a great user experience.
Thanks in advance!
- LauraBrunningCommunity Member
Strangely (to me) it appears to be something to do with the size of the browser's window, as I have just tried it with IE resized to half my screen - and it didn't display the error. Will try and figure it out, but hopefully someone will come and answer who knows how to sort it.
Thanks
- TracyParishSuper Hero
I have been struggling with this all day. Wow. Thanks folks for all the files, sharing, collaboration, examples, helping, etc. It made a big difference, but I missed one step somewhere along the line and finally figured out what was wrong.
Here is my 2 cents, for what it's worth now, on why mine didn't work. Maybe it will help the next person along this path.
I had my folder where the Google Form and Google Spreadsheet set open to Public, but the form/spreadsheet themselves were not. Without ensuring their share properties are public access as well, the variables from the course won't get written into the spreadsheet.
Thanks Tracy for the update and sharing that information here.
- MikeFCommunity Member
This is an old post. Hope someone is listening.
Trying to accomplish this, however, I'm not looking to use a Google form. I want to go straight to the Google sheet from SL2.
SL2 variables >>> Google sheet (cols)
Can't seem to make it work. Also, I can't find the Google "entry.xxxxxxx". How do you locate this from the Google sheet?
Thanks!
- TracyParishSuper Hero
Hey Mike,
Contact me directly and I'll send you what I did yesterday. I sorted through all these posts, played with it for the day and think I finally have it.
Tracy
Hi Mike,
As you mentioned, it's an older thread so you may also want to connect with a few users in case they're not subscribed by using the 'contact me" button on their profile.
- ChristiePollickCommunity Member
Thanks so much for offering to come to Mike's rescue, Tracy! :)
- ChristiePollickCommunity Member
Hi, Edward -- Thanks for your your response, and as this is an older thread and some participants may no longer be subscribed, you are welcome to reach out to individuals directly using the 'Contact Me' link on their profile pages.
- EdwardYankwittCommunity Member
thanx, I will
T/E III Edward Yankwitt
Employee Development Center
245 McKee Rd. Dover, DE 19904
(302) 857-5293 Fax:(302) 739-5751
- ChristiePollickCommunity Member
Sounds good, Edward! I also wanted to mention that when you reply via email, your signature is displayed publicly here in the thread, so you are welcome to edit to remove that information if you wish.
- EdwardYankwittCommunity Member
sorry, how do I edit that info?
- ChristiePollickCommunity Member
Hi, Edward -- If you click on the VIEW button in your email, shown below, it will take you into the threads.
Once you are in the thread, under posts that you have authored, there will be an EDIT button. Simply click on that, remove the information you wish, and hit UPDATE REPLY in the bottom right corner of the reply box. That should do it!
- EdwardYankwittCommunity Member
I understand that. What I meant was how do I edit the info that is displayed on the threads as far as my name, phone numbers, etc.?
I don’t mind my name but I don’t want phone numbers to state lines on the threadThanks,
T/E III Edward Yankwitt
Employee Development Center
245 McKee Rd. Dover, DE 19904
(302) 857-5293 Fax:(302) 739-5751