最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Copy to clipboard function in Google sheets - Stack Overflow

programmeradmin0浏览0评论

I want to write a simple Google function to copy columns A to V of a Google Sheets to the clipboard to use in another application.

I have the following code so far, but I need to get the contents to the clipboard, what mand would I use?

function onOpen() {
    SpreadsheetApp.getUi()
                  .createMenu('Custom Menu')
                  .addItem('Copy Col A to V', 'copycolsAtoV')
                  .addToUi();
}

function copycolsAtoV() {
    var ss = SpreadsheetApp.getActiveSheet();
    ss.getRange('A:V')
}

I want to write a simple Google function to copy columns A to V of a Google Sheets to the clipboard to use in another application.

I have the following code so far, but I need to get the contents to the clipboard, what mand would I use?

function onOpen() {
    SpreadsheetApp.getUi()
                  .createMenu('Custom Menu')
                  .addItem('Copy Col A to V', 'copycolsAtoV')
                  .addToUi();
}

function copycolsAtoV() {
    var ss = SpreadsheetApp.getActiveSheet();
    ss.getRange('A:V')
}
Share Improve this question edited Apr 20, 2015 at 6:48 livibetter 20.5k3 gold badges44 silver badges42 bronze badges asked Apr 16, 2015 at 21:29 user3325770user3325770 611 gold badge1 silver badge3 bronze badges 3
  • You cannot copy to the clipboard programmatically in JS due to security reasons. You may select the content to copy and prompt the user to do 'CTRL+C' – MarcoL Commented Apr 16, 2015 at 21:47
  • What is the other application? – jmunsch Commented Apr 16, 2015 at 21:49
  • Excel - I am using Google sheets to download web data and transferring this data to excell for processing - excell is not as efficient as Google getting data from websites and Google spreadsheet size limitations prevent me from using it as it is very slow - but getting the data across is a bit cumbersome so I want to streamline the process – user3325770 Commented Apr 17, 2015 at 18:51
Add a ment  | 

1 Answer 1

Reset to default 0

I actually achieved this by doing a copy-paste to a throw-away sheet once it is pasted it is left in the clipboard for use

发布评论

评论列表(0)

  1. 暂无评论