'Tables with different size google sheets

I'm trying to importrange data from another sheet in a single formula. I used this formula with diferent ranges in another sheet and it works fine but for some reason this ranges are not working.

The number of rows and columns are diferent size but they are working properly. Not sure why in the second sheet is not working. I have named the ranges where the link is.

Here is the formula that works

={
{IMPORTRANGE(Link1, B2&"!F:F"),IMPORTRANGE(Link1, B2&"!J:T")},
{IMPORTRANGE(Link2, B2&"!F:F"),IMPORTRANGE(Link2, B2&"!J:T")},
{IMPORTRANGE(Link3, B2&"!F:F"),IMPORTRANGE(Link3, B2&"!J:V")},
{IMPORTRANGE(Link4, B2&"!F:F"),IMPORTRANGE(Link4, B2&"!J:S")}
}

Here is the formula that doesnt work

={
{IMPORTRANGE(Link1, B2&"!C:E"),IMPORTRANGE(Link1, B2&"!I:J"),IMPORTRANGE(Link1, B2&"!X:AE")},
{IMPORTRANGE(Link2, B2&"!C:E"),IMPORTRANGE(Link2, B2&"!I:L"),IMPORTRANGE(Link2, B2&"!Z:AC")},
{IMPORTRANGE(Link3, B2&"!C:E"),IMPORTRANGE(Link3, B2&"!I:J"),IMPORTRANGE(Link3, B2&"!X:AI")},
{IMPORTRANGE(Link4, B2&"!C:E"),IMPORTRANGE(Link4, B2&"!I:J"),IMPORTRANGE(Link4, B2&"!X:AE")}
}

The error is this one that makes sense but my first formula works fine. So not sure why is happening.

enter image description here



Solution 1:[1]

I'm not sure you want to juxtapose the different tables. So replace the , by ;. This is the reason that the first one is working properly because all have the same number of rows (may be 1.000) even if they have not the same number of columns.

For the second, as you are also using a , to join the different tables, the error means that there are not the same number of rows from each (may be one tab has less than 1.000). But I guess you want to stack them all. If true, then replace , with ; and change the third one which doesn't have the same number of columns as the others.

edit

try

=query({
{IMPORTRANGE(Link1, B2&"!C:E"),IMPORTRANGE(Link1, B2&"!I:J"),IMPORTRANGE(Link1, B2&"!X:AE")};
{IMPORTRANGE(Link2, B2&"!C:E"),IMPORTRANGE(Link2, B2&"!I:L"),IMPORTRANGE(Link2, B2&"!Z:AE")};
{IMPORTRANGE(Link3, B2&"!C:E"),IMPORTRANGE(Link3, B2&"!I:J"),IMPORTRANGE(Link3, B2&"!X:AE")};
{IMPORTRANGE(Link4, B2&"!C:E"),IMPORTRANGE(Link4, B2&"!I:J"),IMPORTRANGE(Link4, B2&"!X:AE")}
}),"select * where Col1 is not null")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1