I'm a noob trying to pull user details in a web app, display as a row in google sheet, and email the user.
I realize I can't run onEdit to run my working sendMail function if the edit was done via script, but I can't seem to get any alternative working.
I gather the simplest way would be to load my function from the function that populates the sheet, but I can't figure out how and I could really use help.
In my Code.gs file I have a function that handles transferring user data from my app to the sheet named 'handleResponse' and I have a function below which sends an email to the last contact listed on my sheet named 'sendEmailNow'. I've tried calling my sendMailNow function from within the handleResponse function with no luck and the 'onFormSubmit' trigger doesn't do anything as far as I can tell.
Can anyone point me in the right direction? I'm losing hair.
The code I used can be found here: https://community.articulate.com/discussions/articulate-storyline/articulate-storyline-export-to-google-drive
I just don't know how to integrate a mail function with it.
Related
I have a simple postcode search in my wordpress site. The user enters a postcode, clicks search and the browser directs to a new URL based on the postcode entered.
Presently, I have a large switch statement in the onclick handler of the button, which parses the postcode input in a text box and generates some display text and a URL which I then launch using window.open.
It works OK, but as I add more and more postcodes its bloating the code loaded into the browser and it's all visible in dev console. I'm also limited when it comes to making changes as I'm having to go in and modify the code to implement logic directly in my onclick handler. It's a bit of a mess!
What I would like to achieve is to store all of the relevant information in a mysql database, query the DB when the form button is clicked, and then launch the URL which will be returned by the db query (well, there'll be a bit more logic in the server script than that but ultimately I'll just be returning a URL and some text).
I'm struggling to get my head around how to implement this. It appears the DB queries need to be in PHP on the server and has to be queried asynchronously? I'm getting lost down a rabbit hole of AJAX which I'm struggling to understand!
I'm not looking to asynchronously update content on my page - at the point that we're running code in the onclick handler, we're ready to launch a new page based on the postcode entered. It appears the required solution is a little more complex than I hoped it might be.
Can anybody suggest how I might implement this? Do I have to use PHP & AJAX?
Thanks
I have some problem while getting data from another site. In this case I want to get the reservation data from the booking engine site and they want to pass the data to me with Google Tag Manager. I don't really understand what I should do when they just need GTM code. What I should create in my server to get the data from the booking engine with Google Tag Manager ?
This is the illustrations:
I have two sites called sites1.com and sites2.com. In sites1.com I put the Google Tag Manager scripts to push form submit data like full name, last name, email, etc. After somebody submit the form I want to get the submited data in sites1.com to sites2.com with Google Tag Manager. My problem is how to get the data after somebody submited the form in sites1.com in my sites2.com ?
Please anybody knows how to resolve my problem . Thanks in advance .
Well if they implement your GTM from site2.com into site1.com all you need to do is:
Create a trigger for the submit button on the form (use the ID o class of the element and check for the that the Page URL contains site1.com/)
Create a tag where you want the information to be send
Scrap the fields with javascript or ask them to push to the dataLayer the information you need (in this case you can build the trigger based on this event)
And SUPER important: check all your triggers so no other tag fires on site1.com
2.1:
Im not sure if i get where you want this information to be stored but keep in mind GA does not accept PII. On the other hand if you want this in some DB you can just create and endpoint and send the information as parameters. Example:
site2.com/booking_info?field1={{DL variable}}
And just use a Custom IMG tag.
Ive made something like this using API Gateway, Lambda and DynamoDB and it took me 15 mins to set up. (just to give you perspective)
-- EDIT:
Ones you have the information avaliable you can send it to your database using two methods:
Using a HTML tag and making a request with javascript
Making a request with a custom image tag
On the past i ve just added the URL with parameters where you want the request to be made on an image tag and worked perfectly for me.
-- More info:
The custom image tag requests an image from a particular URL. The interesting part is that by making the request you’re actually transmitting information to a server. For example, if you request an image via URL https://www.example.com/something?parameter1=good¶meter2=123, the receiving server processes parameter1 and parameter2 and acts accordingly (e.g. registers those parameters as an event).
Source.
I’m working in modifying a google form to process information from my team. I want them to provide information on New Projects and Existing Projects. If Existing Projects is selected, it displays a URL to take the user to another form. I want the confirmation page to only display the link to the next form if the user has selected “Existing Projects”.
I know previous answers on this site and from Google Help state that you cannot dynamically change the confirmation notice. However, I have written a function which takes the user response and changes the confirmation response using GAS .setConfirmationMessage(). However, this only takes effect using the onSubmit trigger, and the confirmation page is loading too quickly right now to change the information from the current response.
function pageDisplay(){
var form=FormApp.getActiveForm();
var formResponses=form.getResponses();
var lastFormResponse=formResponses.pop();
var itemResponses=lastFormResponse.getItemResponses();
var itemResponse=[]; //initialize array
for (var i=0; i<itemResponses.length; i++){
itemResponse[i]=itemResponses[i].getResponse();
}
switch (itemResponse[0].toString()){
case "Existing Project":
form.setConfirmationMessage("Thank you now please visit URL");
form.setConfirmationMessage(url);
break;
case "New Project":
form.setConfirmationMessage("Thank you for your new information").setShowLinkToRespondAgain(true);
break;
}}
Question: How can I slow down the loading of the confirmation page until after the script has run? Is this possible?
I am getting used to GAS but have no experience in HTML or webpage JS so please be detailed if it involves those. Thank you for your help!
Google Forms doesn't include a built-in feature to change published form behaviors like delaying the displaying of the confirmation page.
One alternative is to get control of the POST request to the Google Form app by using UrlFetchApp but this could unnecessarily over-complicate your a solution to be deployed as "production". If you still want to take this way, you should the use HTMLService to display a html form with a custom form submit action that will emulate the form action of the published Google Form.
I have a website, this website is running JavaScript scripts.
Now I have another python script that is running on another machine (in another network even) that should call a JS function on that specific website.
Now, how do I go about that?
I was thinking about a URL that directs to that very JS function...
But how do I call it then?
I tryed to search it, never really found anything like that... Only somewhat related, but never how to call it from a different machine in a different network.
Clarification:
I want to trigger the "Delete Comment" button in Steam Groups via python.
The URL is http://steamcommunity.com/groups/[name]#comments and the JS function call is
javascript:CCommentThread.DeleteComment( 'clanID', 'commentID' );
So I found this script:
http://steamcommunity-a.akamaihd.net/public/javascript/forums.js
Any idea how to trigger a function in there?
I would like to upload data to a table in bigquery from gsheet, I mean I want to upload the data with code and not with add on, because it will be scheduled later on.
Is there any code example that I can use for that for both ways (append and truncate)?
I have a 2 columns data that I want to load.
The columns are:
name lastName
josh big
john troble
May be some code using the following function
BigQuery.Jobs.insert(resource, projectId)
Looker is great on top of BigQuery and provides a very easy interface for embedding query results in google sheets (as well as excel).
http://www.looker.com/docs/sharing-and-publishing/publishing-looks-with-public-urls
note, I work at (and on) Looker, but I also love BigQuery
Here is a tutorial showing how to use Apps Script within a Google Spreadsheet to: (1) run a query and extract the results and put them into the spreadsheet, and (2) run a load job to import a file from Google Cloud Storage:
https://developers.google.com/apps-script/advanced/bigquery
Since that tutorial was written, BigQuery now supports inserting table rows directly through the tabledata.insertAll method:
https://cloud.google.com/bigquery/docs/reference/v2/tabledata/insertAll
If you want to upload some rows from a Google Spreadsheet into a BigQuery table, it looks like you can use Apps Script to insert the rows directly to BigQuery.
Another approach that should work: you can use Apps Script to create a file in Google Cloud Storage, then you can use example #2 from the first link above to load the data. The Google Cloud Storage API is accessible through Apps Script, so this should be possible. Here's a post showing how one user accomplished this step: http://ctrlq.org/code/20074-upload-files-to-google-cloud-storage
You might want to check Google BigQuery API in Apps Script
https://developers.google.com/apps-script/advanced/bigquery
Upload Job is to be used after you get data from gsheet
BigQuery.Jobs.insert