user
@mb
I am attempting to export data from Captivate into Google Sheets using the widget
I have not been able to get this working. Screenshots of the process would be helpful. I have done my best to set it up per the instructions and cannot get the data to send to the Google Sheet.
reply
Reply
user
@support
Hello. Is there a particular step in the "How to Use..." instructions that's not working for you?
reply
Reply
user
@mb
The steps seem to have been written for a different version of Captivate. I have Captivate 2019 and there seem to be missing steps. I looked at another persons question and found screenshots that matched the instructions, but those were not for Captivate 2019. I created the Google sheet, and

How to Use this Widget in Adobe Captivate
Open Captivate and create a blank variable stencilsheetstoken. (done)

Locate the first slide in your course, create a new action that executes on slide enter, select Execute JavaScript. (screenshots needed, this step is missing a LOT of instructions- I created one through Advanced Actions since that is how you do so in Captivate 2019, but I cannot get it to work)

Paste the following code into the script window: (done, but in my advanced action I made)

Note: make sure this code executes whenever the course is restarted/resumed even if you need to place it on multiple slides.

To save data to Google Sheets, create a new JavaScript action, use the following code: (where does this go?, I tried adding it into my advanced action, but it's not working)
SheetsSet('column header', 'value');
Replace column header with a header of your choice.
Replace value with the data you wish to save.
reply
Reply
user
@support
Locate the first slide in your course, create a new action that executes on slide enter, select Execute JavaScript.
-- In Captivate, to execute an action on slide enter, you need to select the slide, click Properties, in the Actions tab under On Enter select the action to execute (in this case "Execute JavaScript"). See https://we.tl/t-GhGtsZyoRi

To save data to Google Sheets, create a new JavaScript action (where does this go?, I tried adding it into my advanced action, but it's not working)
-- It doesn't matter where you execute this as long as the initialization code from the previous step loads first.

I hope this help.

reply
Reply
user
@mb
I just did all that and it still isn't working for me. I followed the instructions, Published the project, then ran the html to see if it works, and got nothing on my Google sheet.
reply
Reply
user
@mb
Is there a way I can share screenshots?
reply
Reply
user
@support
If you want, post a link to your .cptx file, I'll check and let you know what needs to be done there.
reply
Reply
user
@mb
Here is the file for you to look at [redacted]
reply
Reply
user
@mb
Support, have you had a chance to look at my file?
reply
Reply
user
@support
Hello. You correctly added the initialization code on slide 1. Which data are you saving to Google Sheets? There doesn't seem to be an action for that.
reply
Reply
user
@mb
I attempted to put the code in the last slide, as an action on the submit button. I need the persons name, the course title, and their email address to send to the sheet. Can you show me how to do that properly?
reply
Reply
user
@mb
Today I tried to get the data into the google sheets by creating a javascript executable to be executed when the "Button" is pressed on the last slide. It's still not working. Here is the script I created:
SheetsSet(“Button Clicked”, “true”); SheetsSet('Name', 'Text_Entry_Box_65'); SheetsSet('email', 'Text_Entry_Box_66'); SheetsSet('quizresults', 'score'); SheetsSet('CourseName', 'Work_Skills_I__Section1_Workplace Diversity')

Can you please help me understand what I am doing wrong?
reply
Reply
user
@support
This looks fine, should work. If you want, feel free to upload your file again. If possible, don't post your entire project, just make a copy with only two slides - one with the initialization code and one with SheetsSet action.
reply
Reply
user
@mb
I appreciate your help. It hasn't worked for me at all.
[redacted]
reply
Reply
user
@support
There is an issue on the second slide with all those strange quote characters. This breaks JavaScript. You should only use regular single or regular double quotes. Additionally, the last line does not end with ;

If you leave only the 6 lines that go before the issues start then you will see that everything works properly.

var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
var yyyy = today.getFullYear();
today = mm + '/' + dd + '/' + yyyy;
SheetsSet('field',today);
reply
Reply
user
@mb
I really appreciate your help with this. I am learning this so that I can get these courses built and launched without a staff member that knows how to do it currently on our team. I have been searching the web for answers, and they seem to do nothing but break the code (as you saw yesterday). I even tried a couple different internet suggestions this morning (in a different version of the project), and they did not work. Your version is the closest I have come in that I am finally seeing things o the google sheet, just not exactly what I want to see there yet.
I am still not getting the name entered into the name field nor the address entered into the email field. Additionally, I added to the test version a one question quiz to see if those results were added to sheets, and they are not.

Here is what I get in Sheets now:
Name Email field Button Clicked quizresults CourseName
Text_Entry_Box_65 Text_Entry_Box_66 08/31/2022 score Work_Skills_I__Section1_Workplace Diversity

Can you assist me with getting these corrections made to the code?
Thank-you again!

Here is the link to the altered project [redacted]




reply
Reply
user
@support
If your question is how to get Captivate variables into JavaScript, Adobe provides online resources on this: https://helpx.adobe.com/captivate/using/common-js-interface.html

So, for example, to save the value of variable Text_Entry_Box_65 to Google Sheets you would execute code:
SheetsSet('Some name', window.cpAPIInterface.getVariableValue("Text_Entry_Box_65"));

And the same with the rest of the variables you need. Hopefully this helps.

reply
Reply
user
@mb
I am sorry, this is not working for me. After making the last change, I get nothing in the Google sheet again.
reply
Reply
user
@support
You can post your file, we'll check what's wrong.
reply
Reply
user
@mb
Okay, so here it is again. I have posted and reposted and instead of straight answers on how to write the code make your widget work properly, I get suggestions and samples that do not work. I only get one response per day, always after I leave work, and again, those responses don't work. I am no expert in this, and mere suggestions are not working, even when I copy and paste directly from the "sample". One day I was told never use " or it will break the code, the next day the sample included ".
Please help me with a code that will do the following:
send to sheets: the quiz score, the persons name (from the name entry field), the persons email (from the email entry field), the course name, and the date.
Here is the link to my file [redacted]

reply
Reply
user
@support
Hello, your file is here: https://we.tl/t-09yxzkuCsJ
reply
Reply