Hello. I have searched a lot about sending variables from Storyline to Google Sheet( with app script and without app script). But so far I have not succeeded in doing this. I don't know where the problem is. Please let me know if you have an address that explains more.I have already successfully done the same thing with App Inventor. Thank you.
First mistake in your Storyline. JQuery is not loaded by default in Storyline360 anymore so you need to add it inline in the html or load it as WebObject before you can use jQuery. Oops im sorry...its on the first lines of code... not my preferable way... but lets see if it gets loaded properly.
If you use the console for testing and checking your code you would notice that the error is in timing ( jQuery not loaded quickly enough ) or that the jQuery file wanted is not found...
As you can see in the console here... i get a error message: '$ is not defined' All errors with $ point at jQuery. So it cannot find or load the jQuery library. Either because it isnot loaded when calling it, or because it cannot find the requested file. Gonna troubleshoot it a bit more.
A second attempt with better timing to ensure jQuery could load and its clear...the url is not correct. Here you can find the proper jQuery CDNS you need. https://releases.jquery.com/jquery/
So when checking on https://releases.jquery.com/jquery/ the code for properly injecting jQuery is like this: <script src="https://code.jquery.com/jquery-1.1.1.js" integrity="sha256-6/6tEG91KdLJdvYQDRIjcmzsB4N/QQ92AmlTtBnSCUQ=" crossorigin="anonymous"></script>
So when you replace the code you used inside your script by this url... you get another error...
Now Storyline is trying to connect with your Google Sheet but due to CORS ( Cross Origin Resource Sharing policy ) it is not allowed. This is on any browser nowadays. You have to ensure your calls are allowed cross browser else it will be denied access.
But as we seen in the code we copied from jQuery releases inthere is a setting that allows CORS access... 'crossorigin=''anonymous"' in combination with the sha-encryption.
This means if you add the jQuery in another way...either by WebObject or direct inline in the html with this scripttag... it probably will work.
Well video had to many sensitive information in it....so not sharing that. But this is a working Storyline. Only thing you need to do is have a proper setup on the Google side.
So you publish as HTML... jQuery is not loaded, so its not the same setup as in my file.
Do upload the exact 'Google-Numbers-Working.zip' as i just published it...and then unzip it on your webhost. Running the story.html inthere should work...
14 Replies
i use Google Functions to read, write and update data on Google Sheets.
https://developers.google.com/sheets/api
https://cloud.google.com/functions/docs/concepts/overview?hl=en-GB
On the Google Cloud you create functions for read, write and update in Node.js ... then you can call them easily from within Storyline.
hi thanks
First mistake in your Storyline. JQuery is not loaded by default in Storyline360 anymore so you need to add it inline in the html or load it as WebObject before you can use jQuery. Oops im sorry...its on the first lines of code... not my preferable way... but lets see if it gets loaded properly.
If you use the console for testing and checking your code you would notice that the error is in timing ( jQuery not loaded quickly enough ) or that the jQuery file wanted is not found...
As you can see in the console here... i get a error message: '$ is not defined' All errors with $ point at jQuery. So it cannot find or load the jQuery library. Either because it isnot loaded when calling it, or because it cannot find the requested file. Gonna troubleshoot it a bit more.
A second attempt with better timing to ensure jQuery could load and its clear...the url is not correct. Here you can find the proper jQuery CDNS you need.
https://releases.jquery.com/jquery/
So when checking on https://releases.jquery.com/jquery/ the code for properly injecting jQuery is like this:
<script src="https://code.jquery.com/jquery-1.1.1.js" integrity="sha256-6/6tEG91KdLJdvYQDRIjcmzsB4N/QQ92AmlTtBnSCUQ=" crossorigin="anonymous"></script>
So when you replace the code you used inside your script by this url...
you get another error...
Now Storyline is trying to connect with your Google Sheet but due to CORS ( Cross Origin Resource Sharing policy ) it is not allowed. This is on any browser nowadays. You have to ensure your calls are allowed cross browser else it will be denied access.
But as we seen in the code we copied from jQuery releases inthere is a setting that allows CORS access... 'crossorigin=''anonymous"' in combination with the sha-encryption.
This means if you add the jQuery in another way...either by WebObject or direct inline in the html with this scripttag... it probably will work.
<script src="https://code.jquery.com/jquery-1.1.1.js" integrity="sha256-6/6tEG91KdLJdvYQDRIjcmzsB4N/QQ92AmlTtBnSCUQ=" crossorigin="anonymous"></script>
Testing that now.
And this works. Making a video now step by step as especially on the Google side there also are some things to watch.
Well video had to many sensitive information in it....so not sharing that. But this is a working Storyline. Only thing you need to do is have a proper setup on the Google side.
ok.thanks.thanks.
Hi,when i use storyline in host uploaded ,dont work but when i use in my computer ,work.why?thanks.
Where do you upload ? A LMS ? What LMS ? And what error messages do you get on the LMS ? Clarify some more please.
Hi,
https://www.infinityfree.net/
https://www.gigfa.com/
No error message but dont send data to googlesheet.
So you publish as HTML... jQuery is not loaded, so its not the same setup as in my file.
Do upload the exact 'Google-Numbers-Working.zip' as i just published it...and then unzip it on your webhost. Running the story.html inthere should work...
Hi.Excellent.thanks.
This post was removed by the author