I'm looking to retrieve the most recent financial figure for a single data point from a table using IMPORTXML.
The target page displays three sets of financial figures for a company on quarterly and annual bases. In this case, I only want the "Total Debt" figure listed from the balance sheet for whatever is the most recent fiscal period available.
I've used the following IMPORTXML formula:
This results in only the data label displayed vertically in two adjacent cells.
Total Debt Total Debt
I've also used this IMPORTXML formula with the Xpath query determined using Chrome:
This results in four values (data from two financial statements for two periods each) displayed vertically, as below, in adjacent cells with the third value down being correct. Per this answer to another discussion, I've tried removing the "tbody" element node resulting in an "#N/A" error: "Imported content is empty."
4,207.00 15,826.00 5,208.00 5,220.00
For now, I'm trying to avoid using IMPORTHTML and INDEX for parsing a whole table since I need only a single value from the table.
How do I determine the Xpath query for this page to retrieve (1) the "Total Debt" figure for (2) always the most recent reporting period?
EDIT: Because there are two elements with same name, "Total Debt," I had also tried using the below formula with and without predicates (appending 1, 2, [last], etc. in square brackets) and got returned an error with empty content.
=IMPORTXML("https://www.google.com/finance?q=GOOG&fstype=ii","//*[local-name() = 'Total Debt']")