How to Add a Copy to Clipboard Button in Google Sheets
If you've built a tool using a Google Sheet and the only thing it's missing is a Copy to Clipboard button, you're not alone.
Many people are asking how to add a copy to clipboard button in Google Sheets. Currently, you cannot add a Copy to Clipboard button via script to a Google Sheet. Why? There are two reasons.
First, this is a security concern. Think about it. Google Sheets (Gsuite) is used for a variety of purposes, including storing sensitive information. Allowing users to copy this information via a web script opens up a security concern. Therefore it is generally now allowed in Javascript usage.
Secondly, Google Apps Script runs entirely on the server-side and not at all on the client. Here is an easy to understand explanation of what this means from careerkarma.com
Server-side is the systems that run on the server, and client-side is the software that runs on a user's web browser. Client-side web development involves interactivity and displaying data, server-side is about working behind the scenes to manage data.
As such, Google Apps Script it has no access to your computer in any way - files, browser, clipboard, applications, etc making it impossible for a copy to clipboard button to work.
While you can't make a copy to clipboard button, here are instructions for how to add a button that allows you to clear cells.
How to Copy/Paste in Google Sheets without the Copy to Clipboard Option
Your options for copying and pasting in Google Sheets are different depending on what browser you are using.
If you're using the Chrome browser, you can:
Use keyboard shortcuts
Use the right-click menu
Select Copy or Paste from the Edit menu in the toolbar
On any other browser, you can use one of these keyboard shortcuts:
PC: Ctrl + c for Copy, Ctrl + x for Cut, and Ctrl + v for Paste.
Mac: ⌘ + c for Copy, ⌘ + x for Cut, and ⌘ + v for Paste.
For more options, check out this article from Google Support.
留言