0

When I import 2 ranges that are each in Columns A to L in their respective sheets, the second range is being returned in Columns M to X.

How can I fix it so the data from both ranges is returned in Columns A to L one range below the other?

My current formula

=Query({
   importrange(
     "https://docs.google.com/spreadsheets/d/1xaZ2ZJDRWZOLhgC7MEy9A88hJIxqE-zmfXb4JSzw2yw/edit?gid=801569922#gid=801569922",
     "Missions | RAW!A:L"),
   importrange(
     "https://docs.google.com/spreadsheets/d/1xaZ2ZJDRWZOLhgC7MEy9A88hJIxqE-zmfXb4JSzw2yw/edit?gid=801569922#gid=801569922",
     "Authentication | RAW!A:L")},
   "SELECT * WHERE Col1 IS NOT NULL")

1 Answer 1

0

You are using a comma between the IMPORTRANGE functions, but should be using a semicolon.

                 -----------------
{{A,B}, {C,D}} = | A | B | C | D |
                 -----------------

                 ---------
{{A,B}; {C,D}} = | A | B |
                 ---------
                 | C | D |
                 ---------

So your formula should be:

=QUERY(
   { IMPORTRANGE(
       "1XAZ2ZJDRWZOLHGC7MEY9A88HJIXQE-ZMFXB4JSZW2YW",
       "Missions | RAW!A:L");
     IMPORTRANGE(
       "1XAZ2ZJDRWZOLHGC7MEY9A88HJIXQE-ZMFXB4JSZW2YW",
       "Authentication | RAW!A:L") },
   "WHERE Col1 IS NOT NULL")

Or equivalent

=LET(
  rng," | RAW!A:L",
  id,"1XAZ2ZJDRWZOLHGC7MEY9A88HJIXQE-ZMFXB4JSZW2YW", 
  QUERY(
   { IMPORTRANGE(id, "Missions"& rng);
     IMPORTRANGE(id, "Authentication"& rng) },
   "WHERE Col1 IS NOT NULL"))

Please also note that if the sheets are in the same spreadsheet as the formula, you can use the following:

=Query(
   {"Missions | RAW!A:L";  "Authentication | RAW!A:L"},
   "WHERE Col1 IS NOT NULL")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.