I've created a spreadsheet in Excel 2016 that has an Excel Query to a SQL database configured on a hidden sheet. The query to set to refresh when the file is open (using the External Data Properties, not VBA). While the file is being opened, Excel "selects" the query result cells on the hidden sheet during the refresh. The sheet remains hidden (not visible and no tab at the bottom), but somehow has the focus. You can see this in the screenshot when the shading (the selected cells) does not correspond with the cells on the visible sheet. It is actually selecting the query table in the hidden sheet.
See image here: \1
While this supposedly "hidden" sheet has the focus it is possible to interact with it, including adding or deleting data (or the entire query!). Clicking on one of the tabs at the bottom of the screen returns the focus to that tab and the hidden sheets are no longer readily accessible.
I've tried protecting the hidden sheet, but that blocks the query from refreshing when the file is opened (unless one of the allow options allows a data refresh, but I haven't tested all of them).
This seems to be a bug. Is there a workaround, or does anyone have thoughts on how to properly protect my query from accidental deletion?
Bookmarks