ImportXML extract table into Google Sheets - google-sheets

I'm trying to extract the whole following Warcraftlog table in a Google Sheets.
I just need the "names" with "count" and the "percentage numbers".
=IMPORTXML("URL"; "XPATH")
=IMPORTXML("https://classic.warcraftlogs.com/reports/P4CQdFTp21wADfKX/#boss=-3&difficulty=0&type=auras&ability=31035"; "//table[contains(#id,'main-table-0')]")
But it doesn't work with //table[contains(#id,'main-table-0')] in the Xpath.
With //table/tr/td it will extract nearly everything on the warcraftlog website, except the table I want to extract.
Is there another option to extract them with XPath?

You are after an html table so switch to IMPORTHTML
Data is pulled dynamically from another endpoint you can find in the network tab of the browser, so make your request to that
The last two webpage visible table columns are $ delimited in the retrieved table so you will need to split the entries e.g. using helper column in column D of sheet (if formula in A1) containing SPLIT
=IMPORTHTML("https://classic.warcraftlogs.com/reports/auras/P4CQdFTp21wADfKX/0/0/6175385/buffs/31035/0/0/0/0/source/0/-3.0.0/0/Any/Any/0", "table",1)

Related

Extract html table row to google sheet

I’m trying to extract a single row from a table
When using the google sheet importhtml function, I get the whole table.
=IMPORTHTML("https://www.marketwatch.com/investing/stock/jwn/options?mod=mw_quote_tab", "table",1)
How can I extract just the row right above the word “ Current price as of “
So e.g. in this case the row will have the data below. (this data will change as the date changes)
quote 1.5 0.53 76 1.36 1.47 142 39 quote 0.88 -1.73 23
I have several urls to go thorough
So e.g if I put the following url then the row position will change.
https://www.marketwatch.com/investing/stock/ge/options
Any idea how to extract that just last row right above the word “ Current price as of “
When I saw the HTML data from the URL of https://www.marketwatch.com/investing/stock/ge/options, I thought that the value you expect might be able to be retrieved using IMPORTXML and a xpath. So in this answer, I would like to propose to use IMPORTXML.
Sample formula:
=IMPORTXML(A1,"//tr[td[1]/#class='acenter inthemoney'][last()]")
In this case, the URL of https://www.marketwatch.com/investing/stock/ge/options is put in the cell "A1".
Result:
Note:
This sample formula can be used for the current URL of https://www.marketwatch.com/investing/stock/ge/options. So when the URL is changed and the HTML structure is changed by updated of the site, the formula might not be able to be used. So please careful this.
Reference:
IMPORTXML
ImportHTML() simply allows you to read an (entire!) HTML table or list into your Google sheet.
If you want to filter or manipulate the imported data, then you'll need to use other Google Sheets functions. These are documented here:
Google Sheets function list
Alternatively, you might want to "import" input one sheet, then select certain data into another, separate sheet:
Get data from other sheets in your spreadsheet
Here are some examples for "filtering" your data:
FILTER function

How to concatenate all occurrences of a Google Sheets Query

I have two columns of data and one other column which contains the search key. I am trying to fetch all results that contain a specific text which I'm able to do. The challenge is that I need to concatenate all the occurrences into one single cell.
I have tried the following formula:
=ARRAYFORMULA(IFERROR(VLOOKUP(F2:F,B:C,2,FALSE),""))
Which works but halfway through. So what remains is fetching all the other results into one cell. Currently, it's only fetching a single result.
In this image, the desired output is in F2 for the search key Paul in E2.
Link to my spreadsheet.
https://docs.google.com/spreadsheets/d/16GujlPIn3sqh4DX-taG5b65futHBJrgi6rNmj5zNmdM/edit?usp=sharing
use:
=JOIN(,FILTER(B:B, A:A=E2))

Google Sheets Data Feed has extra column headers in the JSON

I have a client who is using Google Sheets as a data feed. When using the correctly structured URL for the sheet, I see blank columns in the target table. When I look in the code inspector, I see gsx column header properties that are not an exact match with the column headers.
For example, in the table I am looking at, the first column is name "Case Number". This column is blank in the target table even though it should be populated with case numbers. When I look in the code inspector (Google Chrome), I open up the first row of data in the JSON object and see a key named 'gsx$casenumber'. This key has the property 'undefined'.
In the Google Sheet itself, the case numbers fill this column.
What's odd is that, even with a fresh spreadsheet, the 'gsx$casenumber' key has a property $t of 'undefined'. The column header in the Google Sheet is 'Case Number'.
The next key in the Google Sheet JSON object is'gsx$caseprefixtoeachcaseisd202cv'. This is the key in which the $t properties have the case numbers I should be able to see in the rendered table. This is happening in other columns, too.
Is there a way to either remove the first google sheet key in the JSON, or bind the key with the case numbers to the corresponding column header in the rendered table?
Any input or help with this would be greatly appreciated.

Need help in creating a macro for extracting data from list of web url

Need to write a macro for importing a table from all URLs present in column A of Symbols sheet, each URL table should be written to a new sheet with the sheet being named as per the names in column B of Symbols sheet.
Using the below formula to extract table information from URL, which is working.
=IMPORTHTML(symbols!A1, "table",1)
=IMPORTHTML(symbols!A1, "table",3)
A sample sheet URL is below.
https://docs.google.com/spreadsheets/d/1uJPjfAZLRCwafetbH4-nPJPSpTvvgixlFvGG6gYITBU/edit?usp=sharing
Need to customize a few rows and columns which are not required. I believe this can be done by recording a macro and copy-pasting those modification lines to macro.
Edit: I am able to achieve this in MS Excel, one click does the job of importing table, creating a new sheet, copying the table, little formatting. Want to achieve the same in googlesheets.
check the INDEX and ARRAY_CONSTRAIN functions (probably also QUERY and FILTER function too) which are able to trim off the input exactly as you need to.

Import named range data between Google Workbooks

If within the same Google Sheets Workbook, the formula: index(namedRangeRow , namedRangeColumn) works beautifully to "pull" or extract the piece of data residing at the intersection of the named row and named column onto another Sheet in the SAME Workbook.
How do I write a formula to get the same effect when I want to pull data from a DIFFERENT Workbook? I presume it is importRange, but I can't seem to get that formula to recognize two named ranges and find the data at the intersection thereof.
The formula: importRange("key", "namedRangeRow") works great, but it pulls all the data in the target Workbook range. So, I presume it's some variation of that formula, I just can't find the right way to express the two ranges within the importRange function.
The formula in the image below pulls a value in a cell at the intersection of two named ranges from a separate Google spreadsheet (i.e., workbook). (Link to sheet.)
The sheet where the data resides is below. (Link to sheet.)
The SetLinkData sheet is the 2nd sheet in the Set List workbook as in the pic below and contains the ID of the Song Catalog sheet.

Resources