谷歌表过滤怎么办?

时间:2020-06-29 18:40:01

标签: google-sheets google-sheets-formula counting google-sheets-query google-query-language

https://docs.google.com/spreadsheets/d/e/2PACX-1vQ9j9EuHnvBPi_IYhheTbttwG-D5JHYcSGodSl3eSydEG1z5R7PFfKAOw6G-XrNEZQnxvDg_-5PmgDp/pubhtml

我有一个类似上面的链接的Google表格,看起来像这样

Timestamp           Name

6/29/2020 23:32:42  aaaa

6/29/2020 23:32:50  aaaa

6/29/2020 23:32:54  aaaa

6/29/2020 23:33:00  bbbbb

6/29/2020 23:33:05  bbbbb

6/29/2020 23:33:10  bbbbb

6/29/2020 23:33:10  bbbbb

但是我需要获取/创建这样的输出

Name     NumberOfItem

aaaa         3

bbbbb        4

如何在Google工作表上完成此操作

1 个答案:

答案 0 :(得分:2)

尝试:

// Use a range so you directly clamp the value in the Inspector
[Range(1,30)]
public int CubeSize = 3;

// Start is called before the first frame update
void Start()
{
    UpdateTiles();
}

// Using this you can already test the method without entering playmode
// via the context menu of the component
[ContextMenu(nameof(UpdateTiles)])
public void UpdateTiles()
{
    // Destroy current children before spawning the new ones
    foreach(var child in GetComponentsInChildren<Transform>().Where(child => child != transform)
    {
        if(!child) continue;

        if(Application.isPlaying)
        {
            Destroy(child.gameObject);
        }
        else
        {
            DestroyImmediate(child.gameObject);
        }
    }

    if (CubeSize < 1)
    {
        CubeSize = 1;
        Debug.LogError("The cube can not be smaller than 1!");
    }
    else if (CubeSize > 30)
    {
        CubeSize = 30;
        Debug.LogError("The cube should not be bigger than 30!");
    }

    // For making things easier to read I would use x,y,z here as well ;)
    for (float x = 0; x < CubeSize; x++)
    {
        for (float y = 0; y < CubeSize; y++)
        {
            for (float z = 0; z < CubeSize; z++)
            {
                if (x == CubeSize - 1 || x == 0)
                {
                    CreatePiece(x, y, z);
                }
                else if (y == CubeSize - 1 || y == 0)
                {
                    CreatePiece(x, y, z);
                }
                else if (z == CubeSize - 1 || z == 0)
                {
                    CreatePiece(x, y, z);
                }
            }
        }
    }
}

private void CreatePiece(float x, float y, float z)
{
    var extends = 1 / (float)CubeSize;
    var offset = (-0.5f + extends * 0.5f) * Vector3.one + extends * new Vector3(x,y,z);
    var Piece = Instantiate(PiecePrefab, transform, false);
    Piece.transform.localPosition = offset;
    Piece.transform.localScale = extends * Vector3.one;
}