Reputation: 5285
I have a function (and supporting functions) that reads from my Gmail account, parses the contents of the mails to find PayPal payment information, and write that information to a Google spreadsheet. It works perfectly. What I don't know is how the user can invoke this function. Gmail lacks an Add-ons menu or an object model to program against it. So how can my Gmail users invoke the function?
Upvotes: 0
Views: 267
Reputation: 11268
You can write a custom spreadsheet function and invoke it manually by typing the function name in a spreadsheet cell. This works on both desktops and mobiles.
For instance, if the code is:
function getTransaction() {
// Your code here
}
You can go to the spreadsheet, and enter =getTransaction() in the cell to execute the function.
Upvotes: 2
Reputation: 2286
If the script is attached to a spreadsheet then they can just run it from that. Otherwise, you can deploy it as a web app and have an interface separate from Gmail. You can embed it into a Google Site as well.
I have a script that gets each message (not conversation) from a specified timeframe and writes the received date, sender, recipient, message title into a spreadsheet. The user calls this script from a web interface. To allow for extra information (such as instructions and hidden documentation for future maintainers) I embed it into a Google Site. I did that because the script creates new spreadsheets each time, so if it's the same on your end, that's what I would recommend doing.
You can create an HTML file in the script editor and use
function doGet(e) {
var htmlPage = HtmlService.createHtmlOutputFromFile('Index.html')
return htmlPage
}
to display have the web page displayed.
Upvotes: 2