IMPORTXML-导入的内容为空 [英] IMPORTXML - imported content is empty

查看:113
本文介绍了IMPORTXML-导入的内容为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮我吗,我试图从

我使用 INDEX IMPORTHTML 的组合来获取数据.

由于数据为 BOLD ,返回的数据为 * 8,473 * ,因此我使用 SUBSTITUTE 删除了 * ,然后乘以 1000 .

这是公式:

  = SUBSTITUTE(INDEX(IMPORTHTML("https://www.hl.co.uk/shares/shares-search-results/e/easyjet-plc-ordinary-27-27p/financial-statements-和报告",表格",0),41,2),"*",")* 1000 

以下是输出:

有关此问题的更多详细信息,请参见Yahoo Finance page into Google Sheets. I have tried a couple of formulas but keep getting an 'imported content is empty' error.

I've tried the following -

FIRST using Xpath and formula :

=IMPORTXML("http://finance.yahoo.com/quote/EZJ.L/balance-sheet", "//*[@id='Col1-3-Financials-Proxy']/section/div[3]/div[1]/div/div[2]/div[1]/div[2]/div[3]/div[1]/div[2]/span")

THEN (having read that the Xpath might be failing because it contains a reference to the /section/ ) the element and formula:

=INDEX(IMPORTXML("http://finance.yahoo.com/quote/EZJ.L/balance-sheet","//div[@class='Ta(c) Py(6px) Bxz(bb) BdB Bdc($seperatorColor) Miw(120px) Miw(140px)--pnclg Bgc($lv1BgColor) fi-row:h_Bgc($hoverBgColor) D(tbc)'"),1,1)

Grateful for any guidance on how to pull this figure!

解决方案

It seems that the data in the link you provided is dynamically generated thus it can't be fetched by IMPORTXML (same goes for IMPORTHTML, and similar functions).

If you are really determined to just use basic functions in sheets and not do web scraping in apps script, you can do this by finding an alternative site that presents the data statically.

I already did it for you and found this for the same company:

I checked the data and found out that assets which is what you are trying to fetch in your link is also present here but in millions (your old link is in thousands), so we need to multiply the millions by 1000 to get the same data you want in your link.

You can find it in Total Assets (Millions) for the similar date:

I fetched the data using a combination of INDEX and IMPORTHTML.

Since the data is BOLD, returned data is * 8,473 *, thus I used SUBSTITUTE to remove the * and then multiply it by 1000.

Here is the formula:

=SUBSTITUTE(INDEX(IMPORTHTML("https://www.hl.co.uk/shares/shares-search-results/e/easyjet-plc-ordinary-27-27p/financial-statements-and-reports","table",0),41,2), "*", "") * 1000

Here is the output:

For more details regarding the issue, please see this post.

这篇关于IMPORTXML-导入的内容为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆