Forum Discussion

mahdibaghini's avatar
mahdibaghini
Community Member
3 years ago

problem in send data from storyline to googlesheet

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.

 

  • mahdibaghini's avatar
    mahdibaghini
    Community Member
    1. Hi,please share a practical new post about send and recieve data between storyline and googlesheet .thanks
    • MathNotermans-9's avatar
      MathNotermans-9
      Community Member

      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.

    • mahdibaghini's avatar
      mahdibaghini
      Community Member

      Hi,when i use storyline in host uploaded ,dont work but when i use in my computer ,work.why?thanks.

      • MathNotermans-9's avatar
        MathNotermans-9
        Community Member

        Where do you upload ? A LMS ? What LMS ? And what error messages do you get on the LMS ? Clarify some more please.

    • MathNotermans-9's avatar
      MathNotermans-9
      Community Member

      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...