将单元格数据从一个Google工作表发送到另一个工作表,然后覆盖数据 [英] Send cell data from one Google sheet to another and then overwrite data
本文介绍了将单元格数据从一个Google工作表发送到另一个工作表,然后覆盖数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Google工作表(员工时间表),记录了员工每天一周的工作时间.该周结束后(周一-周五),数据将被下周数据覆盖.我需要将数据发送到另一个将存储它的Google表格(员工数据).我该如何发送该数据,以便在下周覆盖之后将其记录下来并且不删除?
I have a Google sheet (Employee Timesheet) that documents employees' hours each day for the week. Once that week has finished (Monday - Friday) the data gets the overwritten with next weeks data. I need the data to be sent to another Google Sheet (Employee Data) where it will be stored. How can I send that data for it then to be documented and not removed once overwritten the following week?
推荐答案
您将需要以下内容:
function tc() {
var reference = 'sheet1!A2';
var rng = SpreadsheetApp.getActiveSpreadsheet().getRange(reference);
rng.setValue(rng.getValue()+1);
var ss = SpreadsheetApp.getActiveSpreadsheet ();
var ss = SpreadsheetApp.getActiveSpreadsheet ();
var source = ss.getRange ("Sheet1!A5:H");
var destSheet = ss.getSheetByName("Sheet2");
var values = source.getValues().filter(function(e) {return e.some(function(f) {return f})});
destSheet.getRange(destSheet.getLastRow() + 1, 1, values.length, values[0].length).setValues(values);
}
随时单元格sheet1!A2
更改范围Sheet1!A5:H
被保存在Sheet2
anytime cell sheet1!A2
changes the range Sheet1!A5:H
gets archived in Sheet2
这篇关于将单元格数据从一个Google工作表发送到另一个工作表,然后覆盖数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文