Basically I store order data in a google sheet.
The Rows are in numerical order corresponding to the order number, is there a way to link clicking on the order number to a gmail search result?
Specifically I'd like to click on the order number cell in Sheets, and trigger a new tab or page, with the gmail search results for the selected order number.
Is this possible?
Best Answer
Can it be done. Yes. I've just been through this myself, and can offer some thoughts.
I created a link using a
HYPERLINK
formula. I made the link part of a template, as well as other links that were inserted by a script (cell.setFormula('=HYPERLINK("'+URL+'","Gmail Lookup")');
). You would need to do the same, it's not just a case of magically clicking your order number.Gmail has several search operators and these can be easily incorporated into a formula. But there's not a lot of documentation/precedents for the structure of the URL, so I experimented in Gmail and noted how the URL changed for different search terms, and then applied those "stub URLs" back to my Sheets formula.
You don't explain the relationship between your order number and gmail so I'll demonstrate three methods that I used.
Search by Label
If you are using sub-labels, then you must search by the complete label (including parents)
Search by Subject
Search by Word/Multiple words