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
- JedidiahEspositCommunity Member
Thanks for this! I was able to get it working after a little fussing.
To anyone having trouble, make sure you add the jQuery library to your story.html after the <head> tag.
It should look something like this:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>Also, you'll have to throw it online somewhere before anything actually feeds into the google form.
- BenTCommunity Member
Hmmmm still having no luck. I have used this exact syntax (below), and replaced the google link, column numbers, and variable names to match my module. No error message appears, but no results post to the google doc either.
The connectivity and form are functioning, as I directly embedded the form into the same module on a different slide and that generates results.
Any ideas? Any help would be greatly appreciated.
var player = GetPlayer();
$.ajax({
url: "https://docs.google.com/forms/d/1AdbAVu3_ER3cL7o6LcDaMSRUfT5Loo6Hlpvc6TuatLc/formResponse",
type: "POST",
data: {"entry.495789985" :player.GetVar("Name"), "entry.647210599":player.GetVar("Event")},
success: function(data)
{
alert(data);
}
});
return false;
- VassilikiBoukiCommunity Member
It works! Thank you all. My warmest and sincerest thanks especially to Jason and to Jedidiah. Great help!
- MikeFCommunity Member
Mucho props for Tracy. She helped me get this up and running.
I wanted to add something here. Tracy mentioned that she is using IE8. So am I, but here is how I got it working. I added a dataType: "jsonp" to the script. It now works for me in IE8.
============================
var player = GetPlayer();
$.ajax({
url: "https://docs.google.com/forms/d/1ebGN0lrq2_DU24UtsQqpD9Zf64TZiPAFNDN9gu8MjlE/formResponse",
type: "POST",
dataType: "jsonp",
data: {"entry.340255159" :player.GetVar("FirstName"),- TracyParishSuper Hero
Thank Mike. I'll add that to my post.
- TracyParishSuper Hero
Brilliant! Mike, you just solved this issue for me.
This was a posting I found for why this works....I have no idea what he is talking about, I'm just glad it does what I need it to.
"It returns your JSON data wrapped in a function name. jQuery handles the function name behind the scenes and passes the data into your success handler. The data is loaded by dynamically creating a script element with the src attribute pointing to the service being called and then attached to the browser's DOM. Then the browser makes a request to the resource and the web service responds with the callback function and data."
- JaneJamesCommunity Member
Figured it out... being a newbie, I didn't realize I was using the wrong quotation marks. After re-typing everything that was going into javascript and the story file, it works! (minus the jsonp... that's a problem for later)
Lessons learned
- try jsfiddle to see if your quotations and brackets are matching
- although I didn't use it (I'm on a hospital computer), notepad++ is apparently good for catching freaky Unicode that doesn't show up on notepad or on the input section of articulate
- if you are stuck, definitely try running CTRL-Shift-J on chrome to see what exact errors you are getting from javascript
- yodeling "never quit" is surprisingly effective (not recommended until desperate)
- VirakYangCommunity Member
Hi Everyone, Just a quick update based on Tracy Trish instruction via this blog post:
http://www.tracyparish.ca/2015/08/how-to-send-variables-from-storyline-to-google-docs.html
The latest script version to include in the story.html is:
<script src=“// http://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js”></script>;
- GinaGrant1Community Member
I would also like to try this...have you found a solution?
- johnfaulkesCommunity Member
Myself and a (very) technical colleague are doing these sorts of things to help with this issue - exporting the values of variables so that you can work with them offline (in a spreadsheet if you wish), and also if you need to, filling Storyline variables with data from external sources.
Send a private message if you want to discuss it in more detail.
John.a.
- DorothyStarkCommunity Member
Sorry, Ben. I stopped using Storyline last spring because I couldn't stop the "low memory" error, so I never pursued this question. You might check with John Faulkes (above) and then post what you find out. I'd still be interested in case I get back to SL.
Dorothy
Hi Ben! It looks like Kevin is helping you out here, but I wanted to pop in and welcome you to E-Learning Heroes