Custom buttons to trigger the Import or Print in Google Sheets

Posted on

Custom buttons to trigger the Import or Print in Google Sheets – Whether you’re just starting out with Google Sheets or are a seasoned pro, sooner or later one of your formulas will give you a formula or script parse error message rather than the result you want. However, every Formula user, irrespective of whether it’s a beginner or expert, has invariably come across a formula parse error in Google Sheets at least once in their life (and if you haven’t. you soon will). It can be frustrating, especially if it’s a longer formula where the formula parse error may not be obvious. In this article, we will talk about some common script or formula parse errors in Google Sheets, like Custom buttons to trigger the Import or Print in Google Sheets, and how to fix it.

I am using an HTML function (HtmlService.createHtmlOutput) to show my custom buttons in a popup or sidebar within my google sheets.

But I am simply trying to make custom buttons to invoke the already existing links in the google sheets menu.. Please see my screenshot below.

I have tried this in the HTML:

<input type="button" id="triggerButton" nclick="document.getElementById('PrintBtnID').click()" />

screenshot of Import and Print link inside menu

Answer :

Google Apps Script doesn’t include a way to call Google Document Editors built-in menu actions and I think that it could not be possible to do that from a dialog / sidebar created using the HTML Service because this elements are in an iframe nested inside the the page.

One alternative could be to use user scripts for extensions like Greasemonkey / Tampermonkey

Similar question in Stack Overflow

Related

Leave a Reply

Your email address will not be published.