One cannot automatically open a document, including spreadsheets, without requiring some user action such as clicking a link.
An alternative approach is to display a pop-up within the spreadsheet containing a clickable link that would lead to opening the document.
This can be accomplished quite easily using a script within the spreadsheet. You may refer to this thread and the docslist documentation. (utilize the doc ID
for accessing docsList.getUrl()
)
UPDATE: In response to your feedback, here is a potential method for automatically hiding the pop-up, integrated into a complete demonstration code.
function test(){
var id = "1cZCL7T-enU0yJZnCb0WM0NeqXDHjnnBUyvs98vsyzwU"; // Example test document (shared in view only)
var Doc = DocsList.getFileById(id);
showURL('Open document named "'+Doc.getName()+'"', Doc.getUrl());
}
function showURL(nameToShow, href){
var app = UiApp.createApplication().setHeight(50).setWidth(300);
app.setTitle("Show URL");
var link = app.createAnchor(nameToShow, href);
app.add(link);
var handler = app.createServerHandler('hide');
link.addClickHandler(handler); // Attach serverHandler to the link itself
var doc = SpreadsheetApp.getActive();
doc.show(app);
}
function hide(){
var app = UiApp.getActiveApplication().close(); // Close the pop-up window
return app; // Apply the changes
}