简体   繁体   English

如何在 Google 表格上将值从一列复制到另一列?

[英]How to copy value from one column to another on Google Sheets?

Is there any formula or script to copy only values (not formulas) from one column to another?.是否有任何公式或脚本可以仅将值(而不是公式)从一列复制到另一列? I don't want to use CTRL + SHIFT + V because I need this to be automatic.我不想使用 CTRL + SHIFT + V 因为我需要它是自动的。 For example:例如:

Column A  Column B
Value1
Value2
Value3

All the values of column A are calculated with an array formula, I need that everytime that column A has a new record the value passes to column B for ever, so if the value or formula in column A is deleted the copied value remains in column B, is it possible to do this? A列的所有值都是用数组公式计算的,我需要每次A列有新记录时,值永远传递到B列,所以如果A列中的值或公式被删除,复制的值保留在列中B、可以这样做吗?

Please any help!请任何帮助!

You want to你想要

  • copy values from one column on a google sheet to another column on the same google sheet将谷歌表格上的一列中的值复制到同一个谷歌表格上的另一列

If my understanding is correct, how about this answer?如果我的理解是正确的,这个答案怎么样? Please consider this as one of many possible ways of solving your problem.请将此视为解决问题的多种可能方法之一。

Flow:流动:
1. Get active sheet 2. Get active range (column) 3. Paste values into the range (column) 1. 获取活动工作表 2. 获取活动范围(列) 3. 将值粘贴到范围(列)中

Sample Script:示例脚本:

function copyvalues() {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getSheetByName('Sheet1');
  const rg = sh.getRange(1,1,sh.getLastRow()); //Explore the various getRange functions
  const va = rg.getValues();  //Explore Arrays if you are not familiar with it
  va.forEach(function(r,i){
    sh.getRange(i+1,2).setValues(r[0]).setNumberFormat('#,##0.00');  //Use setNumberFormat if you need to format your values with two decimal places and thousands separator (if not already done so)
  })
}

Reference:参考:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Google Sheets Macros 从一张工作表复制值并将它们粘贴到另一张工作表中? - How to copy values from one sheet and paste them into another using Google Sheets Macros? 如何使用谷歌表格中的脚本将图像从一个单元格复制到另一个单元格? - How can I use a script in google sheets to copy an image from one cell to another? 通过Google表格中的列名将一个单元格值从一个工作表提取到另一个工作表 - Extract a cell value from one sheet to another by column name in Google Sheets 如何加快速度惊人的慢谷歌表格应用程序脚本功能,将公式从一列复制到新插入的列 - How to speed up surprisingly slow Google Sheets Apps Script functions that copy formulas from one column to newly inserted column 如何根据同一工作表中列的特定值在 Google 表格的另一列中设置值 - How to set value in another column of Google Sheets based on certain value of column in the same sheets Google 工作表脚本将数据集从一张工作表复制到另一张工作表的顶部(仅限值) - Google sheets script copy data sets from one sheet to another (values only) at the top of the sheet Google表格可以将一个单元格更改为另一个单元格 - Google Sheets change one cell from another Google表格脚本复制值从数组到列 - Google Sheets Script Copy Values from Array to Column 将多个工作表从一个电子表格复制到另一个电子表格 - Copy several sheets from one spreadsheet to another spreadsheet Google表格根据单元格值从一张表格复制和粘贴到另一张表格 - Google Sheets Copying and Pasting from one sheet to another based on cell value
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM