Exporting data to an Excel spreadsheet

Oct 12, 2015

I'm creating a eLearning module and need to export user data to an excel file.  Does anyone know where I begin with that?

17 Replies
Matthew Bibby

Yes Mark, absolutely. There is no need to use the results screen at all when implementing this.

You will need to alter part of the code used by the second trigger to have it work with your variables.

In the example shared, Steve is capturing the value of Slider1 (a Storyline variable) and TextEntry (another Storyline variable).

var vRate=player.GetVar("Slider1");
var vSuggestion=player.GetVar("TextEntry");

These two variables (Slider1 and TextEntry) need to exist in Storyline for this to work. 

If I was you, I'd build a sample using the example shared as that will give you a bit of an idea how it works. 

Then you'll need to rewrite the below code for each of the variables you want to capture and add it to the appropriate place in the second trigger, so for example:

var name=player.GetVar("StudentName"); 

Would take the value of StudentName (a Storyline variable) and pass it to a JavaScript variable called 'name'.

Then you'll need to change this section:

data: {"entry.156531987" :vRate,"entry.1547132205":vSuggestion}, 

This is used to copy the value of the JavaScript variable  to the appropriate column in the spreadsheet. The document that Steve wrote (linked in my first post above) shows how to find the correct 'entry.#########' for each column. 

So if we go back to our StudentName example, you'd need something like this:

data: {"entry.123456789":name}, 

Hopefully this is making a bit of sense and I haven't confused you too much! Let me know if you get stuck.

Lesley Condon

Hi Matt, Its been 3 years since this post was created, is it still the same requirements? I am just trying to export students names which they have to enter into a text field, and put them into a google sheet. I haven't managed to get it to work yet so searching all the forums to see whats out there. Thanks


Matthew Bibby

You won't be able to get this Google script working with Excel, as Excel doesn't work in the same way. But in short, yes, it would be possible to get this data into Excel somehow.

For example, you could use this Google Sheets approach, then hook up Zapier and use an Add new Google Sheets rows to Excel trigger to move the data across.

To be clear, I'm not recommending you do this - it's just a possible solution I can summarise in one sentence! It's silly to use both G Sheets and Excel in this way. And if you have lots of data, Zapier will get expensive, but it would work. 

If you can give me some more detail on what you are trying to achiecve, I can likely suggest a better solution.