谷歌工作表中按钮的脚本

时间:2017-01-25 18:08:02

标签: google-apps-script google-sheets

我创建了一个执行以下操作的按钮:

一个。从表1(每日运动)复制一组列并将其粘贴到表2(记录)。

B中。工作表2中粘贴的列将转到下一个空列(或创建一个新列),这样他们就不会过度纠正已存在的信息。

℃。每次我输入新信息时,我都会按下按钮,它会自动复制到第2页。

这是我使用的代码:

==32173== Use of uninitialised value of size 8
==32173==    at 0x5421330: btl_openib_handle_incoming (btl_openib_component.c:3092)
==32173==    by 0x5422A0A: handle_wc (btl_openib_component.c:3401)
==32173==    by 0x5422A0A: poll_device (btl_openib_component.c:3541)
==32173==    by 0x5422A0A: progress_one_device (btl_openib_component.c:3649)
==32173==    by 0x5422A0A: btl_openib_component_progress (btl_openib_component.c:3674)
==32173==    by 0x557ADF9: opal_progress (opal_progress.c:207)
==32173==    by 0x53D53B4: opal_condition_wait (condition.h:99)
==32173==    by 0x53D53B4: ompi_request_default_wait_all (req_wait.c:263)
==32173==    by 0x543933E: ompi_coll_tuned_allreduce_intra_recursivedoubling (coll_tuned_allreduce.c:223)
==32173==    by 0x53E18FB: PMPI_Allreduce (pallreduce.c:105)
==32173==    by 0x5137D42: PMPI_ALLREDUCE (pallreduce_f.c:77)
==32173==    by 0x4F0CAF: __m_solv3dahv_dir_adj_all_MOD_solv3dahv_dir_adj_all (in /data/PROCESSED_DATA/dagnino/01-code/Nicaragua/inv_str2/fwi)
==32173==    by 0x504D03: __m_fwi_MOD_fwi (in /data/PROCESSED_DATA/dagnino/01-code/Nicaragua/inv_str2/fwi)
==32173==    by 0x50C44E: MAIN__ (in /data/PROCESSED_DATA/dagnino/01-code/Nicaragua/inv_str2/fwi)
==32173==    by 0x549EE9: main (in /data/PROCESSED_DATA/dagnino/01-code/Nicaragua/inv_str2/fwi)
==32173==  Uninitialised value was created by a heap allocation
==32173==    at 0x4A05DBC: memalign (vg_replace_malloc.c:858)
==32173==    by 0x4A05E57: posix_memalign (vg_replace_malloc.c:1021)
==32173==    by 0x54837B8: mca_mpool_rdma_alloc (mpool_rdma_module.c:103)
==32173==    by 0x53C0E9F: ompi_free_list_grow (ompi_free_list.c:203)
==32173==    by 0x541D088: prepare_device_for_use (btl_openib_component.c:1217)
==32173==    by 0x542096E: btl_openib_component_init (btl_openib_component.c:2902)
==32173==    by 0x5405E53: mca_btl_base_select (btl_base_select.c:111)
==32173==    by 0x5405191: mca_bml_r2_component_init (bml_r2_component.c:85)
==32173==    by 0x54039C8: mca_bml_base_init (bml_base_init.c:71)
==32173==    by 0x54A3CDF: mca_pml_ob1_component_init (pml_ob1_component.c:181)
==32173==    by 0x549CB73: mca_pml_base_select (pml_base_select.c:132)
==32173==    by 0x53D6219: ompi_mpi_init (ompi_mpi_init.c:522)

我遇到的问题如下

1)每次按下按钮时都不会创建新列,而只是覆盖旧列。 2)原始来源被清除(我知道,它是最后一个功能,它清楚地说明了"清除"我只是不知道要写什么...我想要源保持原样)

如果有人能帮助我使用这个脚本那会很棒.. 谢谢!

1 个答案:

答案 0 :(得分:0)

以下代码应该可以满足您的需求:

function moveValuesOnly() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var source = ss.getRange ("Daily sports!B2:D20");
  var destSheet = ss.getSheetByName("Record");
  var row = 1; //the starting row of the range
  var column = destSheet.getLastColumn()+1; //the starting column of the range
  var numRows = 19; //the number of rows to return
  var numColumns = 3; //the number of columns to return
  var destRange = destSheet.getRange(row, column, numRows, numColumns);
  source.copyTo(destRange, {contentsOnly: true})  
}