Selecting/highlighting next adjacent cell in row after function has been executed in google script


I am not really experienced with coding so I apologize in advance if this is a stupid question with an obvious answer...

I use a google sheet to keep track of things at work, and my employees use it multiple times a day. They will either type one of three phrases into a certain cell on a row, so I have created buttons using the drawing feature that they can simply click, which will insert the appropriate text into the highlighted cell.

Once this text is inserted into the cell, I would like to add something to the end of the function that automatically selects the next adjacent cell in the row (to the right) so they can continue typing in. Currently, once they click the button to insert text into one cell (e.g., B23) they have to use the mouse to manually select C23 before typing into that cell. For some reason you cannot use the right arrow key or tab key on the keyboard to move over, so I am wondering if there is a way to add the selecting process into the script (or even a workaround for allowing the tab or right arrow keys to work).

I realize this may seem like a tedious question and folks may think it is awfully lazy of me to ask for a more efficient way to move over to a cell than using the mouse, but my employees use the sheet hundreds of times a day, so I'd really like to maximize the efficiency for them to make it as easy and convenient as possible. Inputting data can be tedious enough, so I am trying to simplify things and make it as least painful as possible :)

Thanks so much!


There are several ways to select the cell at the right. One way is to use <a href="https://developers.google.com/apps-script/reference/spreadsheet/range#offsetrowoffset-columnoffset" rel="nofollow">offset(rowOffset,columnOffset)</a>:



You are correct. When using a button the focus stays in the button when it is clicked. After some trial and error, I think I found a way that will work fot you. I created a html sidebar that is opened from a custom menu. Once opened, you can leave it opened, HTML allows control over the focus using 'google.script.host.editor.focus()'. Then you can type in the cell. Attached is my sample spreadsheet you can copy and try. Let me know if you need any help changing the button names or text. Sorry my first try didn't work correctly. <a href="https://docs.google.com/spreadsheets/d/1KlNSJnZDNIb2chUK3SlKJg79VNIrsAbIbUvHyLwTLWk/edit?usp=sharing" rel="nofollow">https://docs.google.com/spreadsheets/d/1KlNSJnZDNIb2chUK3SlKJg79VNIrsAbIbUvHyLwTLWk/edit?usp=sharing</a>


  • sql server statement returning values 2 times
  • How can I embed my own .mov in to a web page ?
  • XSLT mapping with metadata and field tags with multiple repetitive elements
  • Copy multiple cell colours from one worksheet to another
  • JQuery - Change certain element classes to specific classes if certain other element is present
  • Shortest path in a grid
  • Installing MEAN Stack: npm -v module.js: 338 throw err; Error: Cannot find module './cache/cach
  • Eclipse > Javascript > Code highlighting not working with Object Notation
  • Why is this code not working? Hangman
  • JQuery UI selectable plugin - Multiple mouse drag selection and unselect option
  • Combine two small queries (that group by different values) into one query
  • UWP - Show textbox text highlight while textbox is out of focus
  • Samsung Galaxy Tab 10.1 and -webkit-tap-highlight-color style?
  • Convert a 12 hour time format to 24 hour time format (keeping record of the day) in python
  • How to make a npm command, that executes two commands in the console (one after another)?
  • In VIm, how to remove all lines that are duplicate somewhere?
  • IE readonly textarea problem
  • Does sql server minds the way records where inserted?
  • Symfony2.1 form date field: Argument 1 passed to … must be an instance of DateTime
  • Prevent parent page from scrolling when mouse is over embedded iframe
  • Linux command line : edit hacked index files
  • Adding directive inside the directive programatically
  • How do you remove the JComboBox 'click and see dropdown' functionality?
  • Double-click autofill - dynamic based on adjacent cell
  • Android device acting as an accessory
  • Updating both a ConcurrentHashMap and an AtomicInteger safely
  • why do I get the error when installing the gem 'pg'? [duplicate]
  • How to avoid particles glitching together in an elastic particle collision simulator?
  • Android fill_parent issue
  • Highlight one bar in a series in highcharts?
  • FileReader+canvas image loading problem
  • Why value captured by reference in lambda is broken? [duplicate]
  • MySQL WHERE-condition in procedure ignored
  • jquery mobile loadPage not working
  • Web-crawler for facebook in python
  • Properly structure and highlight a GtkPopoverMenu using PyGObject
  • trying to dynamically update Highchart column chart but series undefined
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • Change div Background jquery
  • java string with new operator and a literal