在Google表格中复制到剪贴板功能 [英] Copy to clipboard function in Google sheets

查看:176
本文介绍了在Google表格中复制到剪贴板功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个简单的Google函数,将Google表格的 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 command 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')
}


推荐答案

大多数网站使用一些Flash处理副本到剪贴板,因为这不能使用JavaScript完成。 对类似问题的回答表明了这一点:

Most websites handle a copy to the clipboard using a bit of Flash since this can't be done using JavaScript. An answer on a similar question suggest this aproach:


没有办法,你必须使用闪光灯。 名为jquery.copy的JQuery
插件
提供跨浏览器复制和粘贴
使用flash(swf)文件。这类似于我的博客上的语法
荧光笔的工作方式。

There is not way around, you have to use flash. There is a JQuery plugin called jquery.copy that provided cross browser copy and paste by using a flash (swf) file. This is similar to how the syntax highlighter on my blog works.

一旦你引用了jquery.copy.js文件,你需要做的就是推送
数据进入剪贴板运行如下:

Once you reference the jquery.copy.js file all you need to do to push data into the clipboard is run the following:

$ .copy(一些要复制的文本);

美好而简单;)

这篇关于在Google表格中复制到剪贴板功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆