查询多个 google sheets in different sheets with sheet name in column1

Query multiple google sheets in different sheets with sheet name in column1

我需要帮助来显示第 1 列以获取 sheet 它的来源,我当前的公式包含:

=ARRAYFORMULA(QUERY({
{Product1!$AZ2:$AZ&"Product1",Product1!$A2:$AS};
{Product2!$AZ2:$AZ&"Product2",Product2!$A2:$AS}},"SELECT Col2,Col3,Col4
WHERE Col1 is not null 
LABEL Col2 'Date', 
Col3 'Data1', Col4 'Data2'"))

我缺少的代码是什么?第 1 列应包含产品 1 和产品 2,具体取决于哪一行。谢谢

将 Col1 添加到 select:

=ARRAYFORMULA(QUERY({
{Product1!$AZ2:$AZ&"Product1",Product1!$A2:$AS};
{Product2!$AZ2:$AZ&"Product2",Product2!$A2:$AS}},"SELECT Col1,Col2,Col3,Col4
WHERE Col1 is not null 
LABEL Col2 'Date', 
Col3 'Data1', Col4 'Data2'"))