Reputation: 81
I have a query which obtains data from another spreadsheet using IMPORTRANGE function. However, I want to add an index before the result of the query, and it must be together with the query formula.
This query below works but I just need that extra column to show an index count from 1 to the nth row of the query result.
=QUERY(
IMPORTRANGE({ssid},"MASTERFILE!A:AC"),
"select Col 2, Col4, Col7, Col8, Col9, Col11 where Col12 = 'ACTIVATED'",
0
)
Item no. should start with 1 and ends with the nth row provided by the query result.
Upvotes: 1
Views: 746
Reputation: 1
try:
={SEQUENCE(ROWS(QUERY(IMPORTRANGE({ssid},"MASTERFILE!A:AC"),
"select Col2 where Col12 = 'ACTIVATED'", 0))),
QUERY(IMPORTRANGE({ssid},"MASTERFILE!A:AC"),
"select Col2,Col4,Col7,Col8,Col9,Col11 where Col12 = 'ACTIVATED'", 0)}
Upvotes: 2