Google电子表格-对待"Ctrl + V"为"Ctrl + Shift + V"; [英] Google spreadsheet - treat "Ctrl + V" as "Ctrl + Shift + V"

查看:88
本文介绍了Google电子表格-对待"Ctrl + V"为"Ctrl + Shift + V";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以为电子表格定义将 Ctrl + V (常规粘贴)视为 Ctrl + Shift + V (仅粘贴值)?不仅对我自己,而且对任何可以编辑的用户.

Is there a way to define for a spreadsheet that Ctrl + V (regular paste) will be treated as Ctrl + Shift + V (paste values only)? Not only for myself, but for any user that can edit.

原因:所涉及的电子表格中包含数据验证,格式设置和条件格式设置.用户在此电子表格中大量使用 Ctrl + V ,因此这些设置会不断被篡改

Reason: The spreadsheet in question is filled with data validation, formatting and conditional formatting settings. Users use Ctrl + V alot in this spreadsheet, so these settings are constantly being tampered with

推荐答案

我很高兴地宣布,我已经实现了以下尝试达到的目标:

I am happy to update that I have achieved what I tried to achieve as follows:

  1. 创建模板电子表格的副本,以仅用作设计设置模板.
  2. 将相关模板表从设计设置模板Ss复制到目标电子表格中(同时保持隐藏状态).使用 Sheet类完成.
  3. >
  4. 从模板工作表到目标工作表复制格式,条件格式设置和数据验证.使用 copyTo类别Range 完成.
  5. 从目标电子表格中删除临时(隐藏)工作表.
  1. Create a copy of the template spreadsheet, to serve solely as a design setting template.
  2. Copy the relevant template sheet from the design setting template Ss into the destination spreadsheet (while keeping it hidden). This is acomplished using copyTo of class Sheet.
  3. Copy format, conditional formatting and data validation from template sheet to destination sheet. This is acomplished using copyTo of class Range.
  4. Deleting the tempalte (hidden) sheet from the destination spreadsheet.

注意:我将此功能包含在库中,因为它可以在数百个电子表格副本中使用.

Note: I included this function inside a library, as this should work in hundreds of spreadsheet copies.

**

**:

function restoreRangeSettings(e) {
// retrieves data validation, conditional formatting and formatting settings from template
  var editedSs = e.source;
  var editedRange = editedSs.getActiveRange();
  var editedSh = editedRange.getSheet().getName();

  var templateSs = SpreadsheetApp.openById('10zVclYTCEOEwskUID4vxSPxKR_tb3RaR76eG7TfxLUE');
  var templateSh = templateSs.getSheetByName(editedSh);
  var copiedSh = templateSh.copyTo(editedSs).hideSheet();
  var templateRange = editedSs.getSheetByName(copiedSh.getName()).getRange(editedRange.getA1Notation());

  templateRange.copyTo(editedRange, SpreadsheetApp.CopyPasteType.PASTE_FORMAT, false);
  templateRange.copyTo(editedRange, SpreadsheetApp.CopyPasteType.PASTE_CONDITIONAL_FORMATTING, false);
  templateRange.copyTo(editedRange, SpreadsheetApp.CopyPasteType.PASTE_DATA_VALIDATION, false);

  editedSs.deleteSheet(copiedSh);
}

我严重依赖提供的答案这里.

I relied heavily on the answer provided here.

ziganotschka ,谢谢您的帮助!

这篇关于Google电子表格-对待"Ctrl + V"为"Ctrl + Shift + V";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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