Buttons in my Google Sheets move

Skip to first unread message

frank 6000

May 25, 2021, 7:23:08 AM5/25/21
to Google Apps Script Community
I have created a few buttons across the top of a sheet.

They all work fine - however occasionally, I note that one or more have moved out of position.

If I refresh the page, they return to where they should be.

Has anyone else experienced this?

What causes it?

How can I avoid this?


anne marie Gay

May 26, 2021, 4:44:46 AM5/26/21
to Google Apps Script Community
yes i have sometimes this problem


May 26, 2021, 8:32:05 AM5/26/21
to Google Apps Script Community
We have this continuously with a lot of buttons. But some never move.

I've found if you have multiple sheets, clicking to another sheet and then back to the desired resets the button to the desired position. That does not work 100% of the time but does work often.

We've not figured out or found why this is. It is annoying!

Thinking about this more, one of the Spreadsheets we have this issue with continuously is a template that is copied many times. There are two buttons on two different Sheets. One of the buttons is moved every time that sheet is set active.

We also have several spreadsheets that have three buttons on one Sheet and no other buttons on other Sheets. Those three buttons are consistently in the right position.

Do you have any similarities to our experiences?

frank 6000

May 26, 2021, 8:48:10 AM5/26/21
to google-apps-sc...@googlegroups.com
I use buttons a lot on a number of sheets and yes you're right, some buttons do not move.  We do not use templates.

It IS annoying when they move as occasionally users have trouble interacting with them.

I have found the same re: switching to another sheet and back. Usually works.

Surely, this warrants being called a bug?

You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/cba8cd00-72ff-4d86-b12d-4e9a8d497766n%40googlegroups.com.



Jul 30, 2022, 3:28:27 PM7/30/22
to Google Apps Script Community
Here i am 1 year later and google has not fix this bug yet. This takes away part of the benefit of having a button on the first place which is to save time because we have to switch between tabs to fix the positon of the buttons.

Doug Barense

Aug 1, 2022, 6:19:04 AM8/1/22
to google-apps-sc...@googlegroups.com
My guess is they cannot figure out what the bug is. Keeping focus on the issue is good though.

FYI: I've converted to using custom menus as they are more professional looking than a moving button. :D

Thank you!

You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/x2FTqhj27lE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/4639331f-c31d-4e5b-a3bf-958c31f48689n%40googlegroups.com.

Clark Lind

Aug 2, 2022, 11:36:55 AM8/2/22
to Google Apps Script Community
I may have an idea of a possible cause...   I've been playing around with this and think the problem could be related to button placement. 
When you place a button so it is flush in a corner, like this: 
button1.jpg you may think the "anchor" cell for the button is B2. But in reality, you have to take the entire drawing into account
so you also have to account for the handles: 
button2.jpg.  In this example, the actual anchor cell is A1. And if the page refreshes or anything, then it could be moving the button to A1 instead of where you want it in B2.

I used this code to test the theory:

function getButtons() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var ws = ss.getActiveSheet();
  var drawings = ws.getDrawings();  //get all buttons
    drawings.forEach( drawing => console.log(drawing.getContainerInfo().getAnchorRow(), drawing.getContainerInfo().getAnchorColumn()));  //log its anchor cell
    drawings.forEach( drawing => drawing.setPosition(2,2,0,0) );   //move it to where I want it to live  
    drawings.forEach( drawing => console.log(drawing.getContainerInfo().getAnchorRow(), drawing.getContainerInfo().getAnchorColumn())); //log new position

The first log shows the anchor cell as A1, and after moving it, it is now cell B2. This is due to the "handles" on the button. 
After setting the position I want, notice the gap or 'padding' around the button:

Conclusion?  This may be a factor in why some buttons may be moving unexplainably--not yet proven.

I hope that helps a little.  If this isn't the cause, you could still use a similar function like the above to reset the buttons every hour or so, or onEdit, etc.

frank 6000

Aug 4, 2022, 2:38:04 AM8/4/22
to google-apps-sc...@googlegroups.com
Clark - I think you may have the answer!
I shall investigate further ...


James Welsh

Jan 31, 2023, 2:24:41 PMJan 31
to Google Apps Script Community
I couldn't find a bug report for this so I went ahead and created one. Hopefully this issue gets resolved soon.

Reply all
Reply to author
0 new messages