Creating an Extension To Edit Google Doc Spreadsheet - javascript

I'm brand new to coding extensions for chrome so I'm hoping someone here can help or point me in the right direction.
I'm looking to create an extension that when you click on it a drop down comes up with 2 text inputs that will allow me to edit a google doc spreadsheet on the fly. Specifically, I'm tracking customer issues for my site and need to continuously add the number of times per day an issue arises.
So in the first text input box I would like to enter #issue click "Track" and it would add a +1 to the corresponding issue's cell within the Google Doc. In the second text input box if I enter #issue2 textdescription and click "create new issue and track" then the function would create a new row describing the issue (text description) and create a rule that from now on when #issue2 is entered in the first "Track" input box then a +1 will be added to that corresponding cell.
I have been able to create a popup box with inputs, however I am having trouble figuring out how to create a function to carry out what I would like to have done to the Google Doc Spreadsheet.
Hopefully, this isn't too wordy :/

Chrome extensions is not the way to go.
Look at google apps script. Use a menu, sidebar or both.

Related

Google Sheets Apps Script, won't register cell value

I have a google sheet that uses an app script button to send the values from that sheet to another sheet. If someone forgets to press enter after filling in their information, it will not send the last cell value.
So if the cell previously had the value of 3, then we change it to 4, but don’t press enter, it will send the value of 3.
The solution, I think, is at the beginning of the function for it to submit somehow, or press enter, or select another cell, anything that works. But I can’t figure out how to do that so far.
I’ve tried various things but I can't find the right apps script function.
So far without pressing enter, or clicking on another cell, I am unable to access that cell value. Changing the active selection doesn't work.
const sh = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("L1");
// change the active selection to another cell, but it just moves the 4 to the new cell
sh.setActiveSelection('A1');
In Google Sheets, it's not possible to force the cell edit submission (a.k. pressing enter) on behalf the active user. If training your spreadsheet users doesn't look a good solution, then you should consider another way for data entry, i.e. make a form in dialog/sidebar so you can use client side HTML/CSS/JavaScript to control your form.

Tracking clicks on a webpage to a google sheet cell

I'd like to be able to track clicks from a webpage to a google sheet via json, how can I increment values on a sheet?
What I'm looking to do is display one of these codes randomly on a page and log copy clicks (there's a button to copy the code via javascript)
How to:
increment the clicks
locate the cell to increment the clicks
Is this something that's possible w/ google sheets?
I just coded a bitly style google sheet web app and show you how to do it here: https://www.youtube.com/watch?v=1SCtkLc-uFQ
in short you get the values from the column of Codes and then you find that index of the clicks column. Then increment by one.

Is there any hover-like trigger for Google Apps Script in Google Sheets?

Thanks - I'm learning because of you
Thanks to the great posts and comments on stackoverflow, I've learned so many ways to enhance my use of Google Ads (my primary role) via the JavaScript-like Apps Script and now I've moved on to integrating with Google Sheets. Bravo stackoverflowers for your commitment to helping others!
Question
Is there any way to trigger a script attached to a Google Sheets document that would fire on hovering? We have a spreadsheet that contains tabs for the current month's online advertising budgets for a client by month. We duplicate the previous month's tab rather than just adding a column to the existing (previous month) tab because we sometimes added notes in a merged set of cells before we discovered how easy a popup HTML window could be implemented.
I cannot find anything in the scripts guides or via Google searches, but I am using a button that is prominent (just an inserted drawing attached to a script) that can be clicked to pop up an HTML file that explains the documents overall purpose.
Ideally, there would be something that displayed when hovering over a cell or button, but we could also live with something where a popup "speech bubble" would display on the entering of a cell.
Unfortunately, as we all know, there is no "onFocus" event.
With that in mind, are there any options that might accommodate hover, entering a cell but not changing the values, etc? Anything that might allow for tooltips, popups or other guidance to someone reviewing a spreadsheet without an accompanying text document.
Thanks in advance for reading - I've included a screenshot of the way I've currently implemented a per-sheet button that provides notes on specific changes for that tab.
Short answer: There aren't hover-like triggers but you could use notes or comments for showing a text related to a cell.
The docs about triggers are
https://developers.google.com/apps-script/guides/triggers
https://developers.google.com/apps-script/guides/triggers/installable
An the related event objects are listed in
https://developers.google.com/apps-script/guides/triggers/events
Here is how a cell with a "hidden" note looks
Here is how a cell and a displayed note looks
Cell notes could be inserted from the UI and by using Google Apps Script, i.e. setNote(note)
Related
Google Apps Script Spreadsheet Comment Automation

Append a word to title of Google Calendar event using javascript bookmarklet

I maintain a google calendar for 4 branches.
I've currently got a little bookmarklet (actually 4) that let's me put in the precise address with a simple click. However I'd like to add to the functionality so that when I click the button it adds the name of the branch to the end of the title in addition to pasting in the appropriate address. I'd like to add code to this so when I click it, (Headquarters) is appended to the end of the title.
javascript:var a=document.getElementsByClassName('textinput')[1];a.value='Headquarters Branch, Street, County, State, 12345';var e=document.createEvent("HTMLEvents");e.initEvent('change',true,true);a.dispatchEvent(e);void(0);
Bonus: By default the calendar selector is set to headquarters. If I could also change that to the appropriate branch when I click one of the others that would be fantastic!

Custom Autocomplete in Google spreadsheet app

My question is the following, is there any tutorial about how to make that when you begin typing on a google spreadsheet cell, the fields belonging to a custom list that contains (anywhere on the text) the typed characters appears in a drop down list.
I do not know a lot of Javascript, so if there's any book or reference where I can found something similar it would be really appreciated.
I am new, and I don't know of any method for allowing the selection of valid values
to be position based upon what the user starts typing (into a cell).
I know this cannot be done within a script. All scripts run after the user
has made all of their changes (to a cell).
You may already know about a drop-down validation list using defined ranges.
This process puts a small down arrow adjacent to the right-edge of the box.
It allows the user to select from a pre-defined list. It does not prevent
the end user from entering invalid values. It just marks their value as
invalid if it does not agree with one of the entries in the list. And
by pressing the down-arrow, the list of valid values is displayed. The
user can select an entry in the list by clicking on it.
I learned about this validation from the documentation. If that is all you need
then you can stop here.
To me the interesting thing about this validation method is:
you can define the list and give it a name. The invalid error message will include the name. You can use the name to indicate the type of validation error.
The list can be contained on a different sheet other than were it is referenced. The sheet that contains the list can be hidden.
If you add a row to the list area that is not the bottom row, (insert below) the spreadsheet engine will automatically adjust the size of the defined range. The new values entered in the list appear in the updated drop-down list (in the order that they appear in the range definition).
What I have not tested is expanding the list from a script. I don't
know if the spreadsheet engine will perform the same range modification
if the change comes from a script. I would hope that it would.
Also I don't know if you make a changes to a hidden sheet from a script,
then will the hidden sheet remain hidden. I know when you do a "copy sheet"
function from a script, the source sheet is temporarily made current,
and is therefore no longer hidden.
Hope this helps.

Categories

Resources