简体   繁体   English

如何使用新的 Google 电子表格的数据填充特定工作表中的单元格

[英]How to fill a cell in a specific sheet with data of new Google spreadsheets

I have a sheet called "metrics" with one row for each day, for example:我有一张名为“metrics”的表格,每天一行,例如:

day           counts1  counts2  counts3
01-01-2019
01-02-2019
01-03-2019
01-04-2019
01-05-2019
...

Each day I create a new sheet called the same as the date.每天我都会创建一个与日期相同的新工作表。 For example, in 01-06-2019 I create a sheet called "01-06-2019" and enter data into it.例如,在 01-06-2019 中,我创建了一个名为“01-06-2019”的工作表并在其中输入数据。 With this daily data, I calculate for each day counts1, counts2 and counts3.有了这个每日数据,我计算了每天的 counts1、counts2 和 counts3。

I want to fill the sheet "metrics" with those values adding a new row and the corresponding counts1, counts2, counts3.我想用这些值填充表格“指标”,添加一个新行和相应的计数 1、计数 2、计数 3。

Or, is it another better way to save the data and achieve this goal?或者,这是另一种保存数据并实现这一目标的更好方法吗?

paste in B2 cell and drag down the small blue square粘贴在 B2 单元格中并向下拖动蓝色小方块

={SUM(    INDIRECT(TO_TEXT(A2)&"!B2:C2")),
  AVERAGE(INDIRECT(TO_TEXT(A2)&"!C2:C")),
  SUM(    INDIRECT(TO_TEXT(A2)&"!B2:B"))}

to create sheets/tabs you can use this script:要创建工作表/选项卡,您可以使用此脚本:

function onOpen() {
    SpreadsheetApp.getUi().createMenu('NEW DAY')
        .addItem('Create New Tabs', 'createTabs')
        .addToUi()
}

function createTabs() {
    var ss = SpreadsheetApp.getActive()
    ss.getSheetByName('metrics').getRange('A2:A').getValues().filter(String)
        .forEach(function (sn) {
            if (!ss.getSheetByName(sn[0])) {
                ss.insertSheet(sn[0], ss.getSheets().length);
            }
        })
}
  • add this script添加这个脚本
  • reload spreadsheet with F5使用F5重新加载电子表格
  • select column A选择A列
  • click on 123 button点击123按钮
  • and select Plain text并选择Plain text
  • add new days in column A在 A 列中添加新天数
  • then click on NEW DAY然后点击新的一天
  • select Create New Tabs选择创建新标签

this will automatically create new tabs from a list of dates in A column by skipping already created tabs/sheets and also skipping empty cells这将通过跳过已创建的标签/工作表并跳过空单元格从 A 列中的日期列表自动创建新标签


to avoid typing in dates each time, use this formula in A2 cell and drag down:为避免每次都输入日期,请​​在A2单元格中使用此公式并向下拖动:

=TO_TEXT(TEXT(DATE(2019, 1, 1)+ROW()-2, "MM-dd-yyyy"))

how to add a script to your spreadsheet如何向电子表格添加脚本

  • go to Tools转到工具
  • select Script editor选择脚本编辑器

    0

  • copy paste the script复制粘贴脚本

  • save the project under some name以某个名称保存项目

  • click on run icon and authorise it...点击运行图标并授权...

  • select your account选择您的帐户

  • click on Advanced点击高级

  • select Go to * (unsafe)选择转到 *(不安全)

  • click on Allow and return to your sheet (you can close script window/tab)单击允许并返回到您的工作表(您可以关闭脚本窗口/选项卡)

暂无
暂无

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

相关问题 Google Spreadsheets:每次更改都将单元格的内容记录到新工作表中 - Google Spreadsheets: Log content of cell into new sheet on every change 使用 Google 脚本从 Google 表格上的特定单元格命名新表格 - Naming a New Sheet with Google Scripts from a specific cell on a Google Sheet 如何将工作表中的所有数据转换为值-Google电子表格 - How to transform all data in sheet to values - google spreadsheets Scipt:根据特定单元格的值在新单元格中输入数据并提交自动填写谷歌文档 - Scipt: Input data in new cell based on value from specific cell and form submit auto fill a google doc 跳转到谷歌电子表格宏中的特定单元格 - Jump to specific cell in google spreadsheets macro 如何将单元格值或 function 传递给谷歌电子表格中 QUERY 命令的数据 - How to pass a cell value or a function to the data of QUERY command in google spreadsheets 完成Google表单后,如何在Google Spreadsheets中现有工作表的末尾创建新行? - How to create a new row at the end of an existing sheet in Google Spreadsheets after completing a Google Form? 无法在新的 Google 电子表格中发布特定单元格 - Unable to publish specific cells in new Google Spreadsheets Google工作表:如何添加链接以跳转到其他工作表的特定单元格 - Google sheet : How to add link to jump to specific cell of other sheet Google Spreadsheets:如何将特定列的单元格值转换为包含单元格值的超链接? - Google Spreadsheets: how to convert cell values of specific columns into hyperlinks that contain the cell's value?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM