I am trying to extract a couple of elements using the =importXML function in Google sheets from this source: https://www.ibm.com/homepage_sitemap.xml
=IMPORTXML("https://www.ibm.com/homepage_sitemap.xml","//url[*]/loc")
It is throwing me a N/A error. Below picture is what I would like to extract. Also, href= against each hreflang value but I am stuck at the first extraction.
You can try using this formula:
=IMPORTXML("https://www.ibm.com/homepage_sitemap.xml","//*[local-name() ='url']/*[local-name() ='loc']")
try:
=IMPORTDATA("https://www.ibm.com/homepage_sitemap.xml")
and to get url:
=ARRAYFORMULA(QUERY(REGEXEXTRACT(
IMPORTDATA("https://www.ibm.com/homepage_sitemap.xml"),
"(http.+/)"""), "where Col1 <> '#N/A'"))
Related
Using IMPORTXML in google sheets. I want to extract part of the result into one cell.
=IMPORTXML(B1,"//div[#class='orca-rating SwtJyda color-yellow tbody-6']/span")
I got the result spread over several columns. B8:F8
The inspect element is like this. I only want the value "2". It is in cell B8.
I think this can be done using substring-after. But I could not get the correct result.
In your situation, how about the following samples?
=REGEXREPLACE(JOIN("",IMPORTXML(B1,"//div[#class='orca-rating SwtJyda color-yellow tbody-6']/span")),"[^0-9]","")
=REGEXEXTRACT(JOIN("",IMPORTXML(B1,"//div[#class='orca-rating SwtJyda color-yellow tbody-6']/span")),"\((.*)\)")
References:
REGEXREPLACE
REGEXEXTRACT
I use this formula. That works too.
=INDEX( IMPORTXML(B1,"//div[#class='orca-rating SwtJyda color-yellow tbody-6']/span"),3)
But tanaike's formula is very good.
I have a Google Forms where I'm capturing data in the following format.
Name:Karslten [0023]
Level:1
You managed to complete:
Burpies:30
Squats:45
Bench:29
Crunch:43
TotalLoss: 981
Name:Jaeger [0119]
Level:3
You managed to complete:
Burpies:40
Squats:53
Bench:45
Crunch:53
TotalLoss: 1253
Name:Fostyne [0003]
Level:1
You managed to complete:
Burpies:24
Squats:38
Bench:25
Crunch:32
TotalLoss: 758
I would like to know if it will be possible to use Google Sheets formula to use the data and format it into rows and columns in a specific way. One form entry can contain data for multiple persons.
The format I want to achieve should look like this and all new entries must be appended to the new result sheet.
Screenshot for the format I want from Google Sheets
Here is a link to a dummy editable Google Sheets with the same data. I hope some knowledgeable people can help me achieve this. Thanking you in advance.
try:
=ARRAYFORMULA(QUERY(IFERROR(SPLIT(FLATTEN(TRIM(REGEXREPLACE(
'Form Responses 1'!B2:B&CHAR(10)&SPLIT(SUBSTITUTE('Form Responses 1'!C2:C,
"Name:", "×Name:"), "×"), "(.+:)", ))), CHAR(10))), "where Col2 is not null", ))
hope you have a good day/evening.
Due to I always seems to use importrange function to import multiple sheets. I want to have a quicker way to replace the date (highlighted in red as per the screenshot) with the date referenced in Col A. This is my Google Sheet under the tab name "TextJoin" Google Sheets Link
try:
=INDEX({""; "={"&TEXTJOIN("; ", 1,
"IMPORTRANGE(""13DWtP4L7swqBgK6BGLeA-o_FfyD-D8-Ru30cOPf0I10"", """&
FILTER(TO_TEXT(A2:A)&"!A2:C"")", A2:A<>""))&"}"})
but you may need to wrap it into query and remove empty rows perhaps like:
=INDEX({""; "=QUERY({"&TEXTJOIN("; ", 1,
"IMPORTRANGE(""13DWtP4L7swqBgK6BGLeA-o_FfyD-D8-Ru30cOPf0I10"", """&
FILTER(TO_TEXT(A2:A)&"!A2:C"")", A2:A<>""))&"}, ""where Col1 is not null"", )"})
Try
=importrange("_____","'" & text(A2,"M/d/yy") &"'!A2:C")
enter link description hereI'm trying to get a return of all Active jobs but I keep getting the error message #value!; "Unable to parse query string for Function QUERY parameter 2: NO_COLUMN: A". Here is the formula I used.
=QUERY({IMPORTRANGE("SheetKey","employeeName1!A18:V1000"); IMPORTRANGE("SheetKey","employeeName2!A19:V1000");IMPORTRANGE("SheetKey","employeeName3!A19:V1000");IMPORTRANGE("SheetKey","employeeName4!A19:V1000")},"SELECT A, B, C, D, E WHERE E = 'Active'")
I tried replicating your issue by making a copy of your provided sample sheet but apparently, the formula works after making a copy of the sheet. Please see attached screenshot.
I suggest trying to copy it first making a new sheet with the same content and see if it will also solve your problem.
use:
=QUERY({
IMPORTRANGE("SheetKey", "employeeName1!A18:V1000");
IMPORTRANGE("SheetKey", "employeeName2!A19:V1000");
IMPORTRANGE("SheetKey", "employeeName3!A19:V1000");
IMPORTRANGE("SheetKey", "employeeName4!A19:V1000")},
"select Col1,Col2,Col3,Col4,Col5
where Col5 = 'Active'")
I took out the IMPORTRANGE and just used a query formula for the other sheets and it worked perfect. Thanks for the input everybody.
This code calculates a sum of string lengths in the range H1:V5 using G as a row index and C as a column index. It works perfectly in Excel:
{=SUMPRODUCT(LEN(INDEX(H1:V5,N(IF({1},ROW(G2:G5))),N(IF({1},C2:C5+1))))*ISNUMBER(G2:G5))}
But when I try it in Google Sheets it doesn't work although Google Sheets recognizes all commands. Is it possible to convert my formula to Google Sheets? Or maybe there is some workaround to get the same result there?
Open with Google Sheets returns incorrect result:
=ARRAY_CONSTRAIN(ARRAYFORMULA(SUMPRODUCT(LEN(INDEX(H1:V5,N(IF({1},ROW(G2:G5))),N(IF({1},C2:C5+1))))*ISNUMBER(G2:G5))), 1, 1)
Unfortunately the construct index...n(if({1}... is peculiar to Excel.
The vlookup function in Google sheets is very versatile and you can use that instead:
=SUMPRODUCT(len(vlookup(row(H1:K5),{row(H1:K5),H1:K5},C1:C5+2,false))*isnumber(G1:G5))