Import CSV to google sheets with separate headers by client - google-sheets

I have downloaded the data to csv via Postman.
The problem is that I don't have a classic structure:
id;name;country
1;Paul;USA
2;John;Germany
but structure like this
id:1;
name:Paul;
country:USA;
id:2;
name:John;
Country:Germany
Do I still need to edit the data in Postman, or is there any way to import it directly in google sheets?

example of recombination:
=ARRAYFORMULA(QUERY(TRANSPOSE(SPLIT(FLATTEN(QUERY(QUERY(IFERROR(PROPER(SPLIT(A1:A; ":;")));
"select max(Col2) where Col2 is not null group by Col2 pivot Col1");;9^9)); " "));
"select Col2,Col3,Col1"))
demo sheet

Related

Google Sheets Query And Importrange Equals Cell D2

I've got two spreadsheets, a primary sheet (that a google form dumps into) and another sheet (aka management sheet) that has shared access to the primary sheet. I'm trying to run the query below to automatically import a serial number based on the hostname in column D of the management sheet.
I can run a simple importrange successfully, so the access permissions are working properly.
=QUERY(IMPORTRANGE("[URLHERE]”, “Form Responses 1!A2:H”), ”Select Col7 where Col5="&$D2))
Any help would be appreciated, thanks in advance!
Jerome
try:
=SINGLE(QUERY({IMPORTRANGE("1pRWLfnYsJhmJFZio_pvny7oO8UCSUxfGhTc78TbwVhw",
"Form Responses 1!A:H")}, "select Col7 where Col5 = '"&D2&"'", )
I figured it out.
=query({IMPORTRANGE("1pRWLfnYsJhmJFZio_pvny7oO8UCSUxfGhTc78TbwVhw", "Form Responses 1!A2:H")}, "Select Col7 where Col5 = '"&D2&"' LIMIT 1",0)
Jerome

Combining multiple IMPORTRANGE WITH QUERY

I'm trying to import data from multiple spreedsheet to one using query,
=QUERY({IMPORTRANGE("1wMGl6qkQuz5ux42u4w8YAIEGiB3SN2b4EcgVJI-RTx4","DELIVERY DETAIL!$A$3:$I");
IMPORTRANGE("1A2dgmXRWbCzc9_jH38WruOMALsXrq8RFx7BcDW9Z8EI","DELIVERY DETAIL!$A$3:$I") },
"SELECT Col1,Col8,Col9 ",0)
the problem for me i get the data from one spreedsheet and receive nothing from the 2nd one,(i tried both of the importrange seperately without the query and it's working good), and it's importing the data from the source but when both of the importrange work it bring just data from 1st spreedsheet
BTW the name of the tabs are the same as i made duplicate the same spreedsheet
you did not filter out empty rows. try:
=QUERY({
IMPORTRANGE("1wMGl6qkQuz5ux42u4w8YAIEGiB3SN2b4EcgVJI-RTx4","DELIVERY DETAIL!$A$3:$I");
IMPORTRANGE("1A2dgmXRWbCzc9_jH38WruOMALsXrq8RFx7BcDW9Z8EI","DELIVERY DETAIL!$A$3:$I")},
"select Col1,Col8,Col9
where Col1 is not null", 0)

Importrange from multiple google sheets, issue when any one sheet has no data to import

I am importing data from two different Google sheets and merging them in another sheet. The formula which I used is as below .
=QUERY({
IFERROR(QUERY(
{ IMPORTRANGE("" , "Sheet1!$A$1:$b") },
"SELECT Col1,Col2 WHERE Col2='Total'",
0
)) ;
IFERROR(QUERY(
{ IMPORTRANGE("" , "Sheet1!$a$1:$b") },
"SELECT Col1,Col2 WHERE Col2='Yes'",
0
))
})
In above formula, importrange is giving the result when both sheets have data to import, but if any one sheet has no data to import the data from another sheet is not getting imported. I had figured a solution at below link where we can handle this issue by using dummy column reference, this approach is fine when we have few sheets to import with few columns but when we are importing from many sheets and many column to import the dummy column reference gets too long. Is there any other way to solve this issue.
The easiest way to do this is to use an IFERROR(SEQUENCE(1,n)/0) as your output for when a query of an importrange fails instead of needing to list a bunch of blanks.
The solution for your simple example looks like this where n = 2:
=ARRAYFORMULA(QUERY({IFERROR(QUERY({IMPORTRANGE("1hea986JF3plR_tn7plNRgjWhiGqxOlR8s8yE-Ri6FfU" , "Sheet1!$A$1:$b")}, "SELECT Col1,Col2 WHERE Col2='Total'",0),IFERROR(SEQUENCE(1,2)/0));IFERROR(QUERY({IMPORTRANGE("1IbPpoLLfa-ukoz2WInlgNGSNMNBxBwSx4in52fZCEyE" , "Sheet1!$a$1:$b")},"SELECT Col1,Col2 WHERE Col2='Yes'",0),IFERROR(SEQUENCE(1,2)/0))},"where Col1 is not null"))

Import Craigslist information

I'm trying to import the data from Craigslist into Google Sheets. I'm using importxml and have made some progress but can further refine the function.
A3: https://norfolk.craigslist.org/ctd/d/2011-volkswagen-jetta-only-82k-miles/6910694177.html
=IMPORTXML(A3,"//div[#class='mapAndAttrs']//p[#class='attrgroup'][2]")
This seems to return all information but I want to trim it to search for fuel in the result and show gas/diesel/whatever may be.
=QUERY(TRANSPOSE(IMPORTXML(A3,
"//div[#class='mapAndAttrs']//p[#class='attrgroup'][2]")),
"where Col1 contains 'fuel'")
=SUBSTITUTE(QUERY(TRANSPOSE(IMPORTXML(A3,
"//div[#class='mapAndAttrs']//p[#class='attrgroup'][2]")),
"where Col1 contains 'fuel'"), "fuel: ", )

Combining multiple Google sheets into single Google spreadsheet

I have multiple google sheets (45 of them, all dynamic, its content will keep on changing) and I want to combine data of all of them into a single file. I was hoping to use some importrange or QUERY function so that moment one / any file is updated, the changes reflect automatically on the combined sheet.
Example book 1 :
https://docs.google.com/spreadsheets/d/1sOkV9BT8ptndE0xcN2MUi4tTZ5p-aZxuLY_u29Y6nBI/edit?usp=sharing
Example book 2 :
https://docs.google.com/spreadsheets/d/1jZml9oVI2Flma407AB4ndl_ZIsQ_5I8zhkzvbL_EO_g/edit?usp=sharing
Example combined book :
https://docs.google.com/spreadsheets/d/1LkiIY1aUmwaouR7f4KhaGs6MV365KY7DYUPMiTzxjvc/edit?usp=sharing
first you need to connect them by pasting each IMPORTRANGE formula in some cell to get #REF! error
then hover over that #REF! error with your cursor and a secret magic button will popup
click on it to allow access
then you can stack up all import ranges and wrap them in a query:
=QUERY(
{IMPORTRANGE("ID1-or-URL1", "Sheet1!A1:A");
IMPORTRANGE("ID2-or-URL2", "Sheet1!A1:A");
IMPORTRANGE("ID3-or-URL3", "Sheet1!A1:A");
IMPORTRANGE("ID4-or-URL4", "Sheet1!A1:A")},
"where Col1 is not null"), 0)
update:
={ IMPORTRANGE("1sOkV9BT8ptndE0xcN2MUi4tTZ5p-aZxuLY_u29Y6nBI", "Sheet1!A1:N2");
QUERY({IMPORTRANGE("1sOkV9BT8ptndE0xcN2MUi4tTZ5p-aZxuLY_u29Y6nBI", "Sheet1!A3:N" );
IMPORTRANGE("19SFnJab9xVW2SenK-8IuG2cQRT2exJeyqARjTdDE_R8", "Sheet1!A3:N" )},
"where Col1 is not null", 0)}

Resources