Im trying to import more than a 100 files into one masterfile.
The problem I'm having is that when I use query null to filter blank rows, some cells return as blank (probably because the entries to that cell's column may either be a text or number string)
Is there any way around this so that the query will just take the values/any string within the cell. I'd hate to see a lot of blank rows from the import of more than 100 files!
Appreciate any help. Thank you!
before using QUERY you can force the text format with TO_TEXT so:
=ARRAYFORMULA(QUERY(TO_TEXT({
IMPORTRANGE("id1"; "A1:A");
IMPORTRANGE("id2"; "A1:A");
IMPORTRANGE("id3"; "A1:A")}); "where Col1 is not null"; ))
keep in mind that every of your 100 importranges needs to be run as standalone fx prior to using the above formula to connect your sheets by allowing the access
Related
I'm copying a range of data (one column only) using QUERY(), however, I am trying to find a way to insert blank rows whenever a certain value is shown.
here, I'm trying to insert 2 blank rows whenever the value b1 shows. I've been trying to accomplish this with some query() and arrayformula() formula but I'm not getting close. We're trying to complete this using formula only (no scripts)
Here's the sample sheet
My solution is:
=query(flatten(ArrayFormula(split(transpose("b1 & & "&split(ArrayFormula(textjoin("&",1,A5:A)),"b1",0,1)),"&",1,0))),"select Col1 where Col1 is not null offset 2")
This is not perfect as there are spaces instead of blank rows. But I hope it might help you.
I'm trying to turn an array into a single column without blank cells, considering that the input will always have some blank cells and that there might be repeated values. I'm trying to use FLATTEN but it keeps the blanks and UNIQUE would kill the repeated values, so I can't use.
I also thought about using something like FLATTEN(QUERY(X:X, "select * WHERE col1,col2,col3,col4,col5 IS NOT NULL") but number of columns might be dynamic so I can't say precisely which columns to use.
My input:
Desired output:
Sample sheet here
Any clue?
Use QUERY on the outside:
=QUERY(FLATTEN(YOUR-RANGE-HERE),"Select * WHERE Col1 Is Not Null")
I left an example in your spreadsheet, cell G2.
=flatten(filter(A1:E10;not(isblank(A1:E10))))
or
=flatten(filter(A1:E10;len(A1:E10)))
or
=filter(flatten(A1:E10);len(flatten(A1:E10)))
I have a CSV file that I'm pulling from a database. It's in an awkward layout so I need to reorganise it and display the result in a separate sheet.
Here is a dummy example of the data structure I get.
https://docs.google.com/spreadsheets/d/1sTfjr-rd0vMIeb3qgBaq9SC8felJ1Pb4Vk_fMNXQKQg/edit?usp=sharing
It looks like that. The database grows every day by date and sometimes countries so I need to account to that in my formula.
I need to pull data per each country and display it by date.
I don't need data from Column A, C and D. And when there are multiple states I need to sum them up in one column.
It should look like this and keep growing downwards. I'm gonna use this table for a graph chart
What I've tried so far
=TRANSPOSE(QUERY(IMPORTRANGE("url_to_a_separate_sheet_where_I_importing_a_row_csv_file", "CSV-source-sheet!A1:500"), "SELECT * WHERE Col2='Germany'"))
This works, kinda. But pulls in unnecessary columns and I can't figure out how to sum countries with multiple states. When I add select sum(*) it gives me a big and long error. I assume it might be because of unnecessary columns that the formula cant sum up and I don't know how to omit them. I'm stuck
I tried offset and skipping no luck. Any ideas?
try:
=ARRAYFORMULA(TRANSPOSE(QUERY({Sheet2!B:B, Sheet2!E:BE},
"select Col1,"&TEXTJOIN(",", 1,
"sum(Col"&ROW(INDIRECT("Sheet2!A2:A"&COUNTA(Sheet2!1:1)-5))&")")&"
where Col1 is not null
group by Col1
label Col1'Date'", 1)))
spreadsheet demo
I'am working on some document which get data from Non Google form, and the output is 36 column but there will be always filled up 8 max 9 columns with empty columns in between, with our Form we CANT change way how data are outputed. Empty column are here cuz Client fill up specific type of order so data are put in specific column.
i need query for pulling data from the main sheet and output just specific 5 specific column ( those will be always in same place ), and 2 columns that can be anywhere in between.
writing down every single column is not perfect as i need to pull data row by row not all at once ( i will be adding data in between final query output) and with that it would drasticly slow down file with few hundreds inputs added per week.
I didnt found working way to combine filter and query together to do this job ( removing empty columns [ <>'' and is not null].
Could someone help me with this ?
providing link for file : https://docs.google.com/spreadsheets/d/1SDR939yUSq9trLcxBid9AQeZUn-lNNiRr7O7pDiu888/edit?usp=sharing
In cell M1 of your sheet 'Desired output' try entering this little monster
=Arrayformula(query({'Raw data'!A:Z\
{"Configurable list"; 'Raw data'!D2:D&'Raw data'!F2:F&'Raw data'!H2:H&'Raw data'!J2:J&'Raw data'!L2:L&'Raw data'!P2:P&'Raw data'!R2:R&'Raw data'!T2:T&'Raw data'!V2:V}\
{"Date"; ('Raw data'!E2:E&'Raw data'!G2:G&'Raw data'!I2:I&'Raw data'!M2:M&'Raw data'!O2:O&'Raw data'!Q2:Q&'Raw data'!S2:S&'Raw data'!U2:U&'Raw data'!W2:W)+0}};
"Select Col1, Col2, Col3, Col26, Col28, Col24, Col27 Where Col1 is not null format (Col28) 'dd.mm.yyyy'"))
See if that works for you?
Your answer is really in the heading. You can use =filter([Range], [Range]<>"") for each row to get to this in the desired output. The filter function is perfect for this application.
UPDATE:
Looked at your sheet to get a better view of the problem. You'll need some wildcard workaround as shown here as a second criteria to identify the Date & Configurable cells: =filter([Range], [Range]<>"", search("Date", [Top row]))
I'm using Google Sheets and looking for an arrayformula that able to take a list in two columns and arrange it alternately in one column. The sheet contains about 5,000 rows, each row has more than 35 characters.
I tried this:
=transpose(split(join(" ", query(transpose(B5:C),,50000)), " "))
But then I got this message:
Please take a look at the sheet here:
https://docs.google.com/spreadsheets/d/11T1Roj1trviOSiiTZS292-4l3oODid7KLi9oGz3Z66o/edit#gid=0
Assuming your 2 columns are A and B, this formula will "interlace" them:
=query(
sort(
{arrayformula({row(A1:A3)*2, A1:A3});
arrayformula({row(B1:B3)*2+1, B1:B3})}
),
"select Col2")
Explanation, unwrapping the formula from the inside:
Each value gets a unique number, based on its row number times 2 (+1 for the 2nd column)
Everything is sorted based on this number
Only the 2nd column is extracted for the result.
There is a function for this called FLATTEN().
This works perfectly as a general solution since it takes an array of any size and outputs the items in the order they appear left-right-top-down (See here).
It can be combined with TRANSPOSE() to accomplish the same thing but in the horizontal case, and if needed blank cells can be omitted with FILTER().
EDIT:
My sincere apologies, I did not read the question carefully enough. My response is incorrect.
This should work:
={B5:B12;C5:C12}
just be careful to NOT change it to
={B5:B;C5:C}
This will start an infinite loop where the spreadsheet will increase the amount of rows in the spreadsheet to allow this output column to expand, but in doing so increases the length of the 2 input columns, meaning the length of the output column increases even more, so the spreadsheet tries adding more rows, etc, etc. It'll make your sheet crash your browser or something each time you try to open it.
In Row5:
=ArrayFormula(offset(B$5,INT((row()-5)/2),iseven(row())))
Would need to be copied down however.