Ok, so I have solved my problem. I have absolutely no clue why there was an issue, and why my fix worked.
All I did was enter the advanced setting of the Chart, and reduce the range of the data I was using. Basically, reducing the range from A1:F300
to A1:F51
was enough. Once I did this, the exported chart in my GoogleApp started being compliant to the one I have in my sheet. The original range had a lot of empty cells, but my new range still has some. Furthermore, a range of 1800 cells doesn't seem that unreasonable to compute for Google Sheet.
Short answer
AFAIK, regarding XPath queries to be used with IMPORTXML there isn't straightforward method as XPath 1.0 support looks that was not fully implemented and the web pages developers could follow the practices to set the structure of their webpages.
Explanation
While the use of tools like Chrome Developer Tools or browser extensions/add-ons could be helpful sometimes these tools doesn't return a XPath query that could be used by IMPORTXML due to differences on how XPath support was implemented by the developers of each tool, by the other hand, web pages could comply or not with the XML rules, so to find the XPath query to be used with IMPORTXML could be necessary to analyze the structure of the source web page and to do several tries.
XPath queries for the use case
The below XPath queries returns 5,208.00
1.
//div[@id="balinterimdiv"]//tr[contains(.,'Total Debt')]/td[2]
2.
(//tr[contains(.,'Total Debt')]/td[2])[1]
Explanation
The referred page includes two views for the Balance Sheet: Quarterly Data and Annual Data. Both of them looks to have the same structure as both includes a table cell (td tag) with the text Total Debt
. Fortunately, each view are inside a div tag and each of them have their own id, so in order to get only one, the first step in the XPath query could be to select the right view, then the second step could be to select the right table row (tr tag) and the third step to select the right table cell (td tag).
Another approach is to use the construct (xpath_query)[position() = 1]
(see the reference).
References
Best Answer
=
operator=