使 Link 描述指向 IMPORTXML 语句中的 Link 引用
Making Link Description point to Link Reference in IMPORTXML statement
我正在使用 google 表 IMPORTXML 函数抓取 FINVIZ 财务数据,具体而言:
=IMPORTXML("http://finviz.com/quote.ashx?t="&B1,"//table[@id='news-table']/tr")
针对以下来源:
<table width="100%" cellpadding="1" cellspacing="0" border="0" id="news-table" class="fullview-news-outer">
<tr>
<td width="130" align="right" style="white-space:nowrap">Feb-15-20 03:58PM </td>
<td align="left"><a href="https://finance.yahoo.com/news/u-evacuate-citizens-quarantined-ship-043646253.html" target="_blank" class="tab-link-news">U.S. Woman From Cruise Falls Ill as 2,200 Head Home: Virus Update</a> <span style="color:#aa6dc0;font-size:9px">Bloomberg</span></td>
</tr>
<tr>
<td width="130" align="right">03:41PM </td>
<td align="left"><a href="https://www.marketwatch.com/story/afraid-of-sky-high-stock-valuations-consider-this-deep-value-strategy-2020-02-12?siteid=yhoof2&yptr=yahoo" target="_blank" class="tab-link-news">Afraid of sky-high stock valuations? Consider this deep value strategy</a> <span style="color:#aa6dc0;font-size:9px">MarketWatch</span></td>
</tr>
<tr>
<td width="130" align="right">10:47AM </td>
<td align="left"><a href="https://www.marketwatch.com/story/if-you-could-buy-only-one-stock-for-5g-and-artificial-intelligence-this-would-be-it-2020-02-14?siteid=yhoof2&yptr=yahoo" target="_blank" class="tab-link-news">If you could buy only one stock for 5G and artificial intelligence, this would be it</a> <span style="color:#aa6dc0;font-size:9px">MarketWatch</span></td>
</tr>
</table>
因此,如果我选择 Apple (AAPL) 的股票代码,则 IMPORTXML 的 XPATH 组件调用上面 returns 以下内容:
问题:如何修改 XPATH 组件以使新闻描述可点击其 HREF?
我不希望 URL 替换新闻 - 只希望新闻指向其目的地,这样点击新闻就会将我带到 link。
尝试:
=ARRAYFORMULA({INDEX(IMPORTXML("http://finviz.com/quote.ashx?t="&B1,
"//table[@id='news-table']/tr"),,1),
HYPERLINK(IMPORTXML("http://finviz.com/quote.ashx?t="&B1,
"//table[@id='news-table']/tr//a/@href"),
INDEX(IMPORTXML("http://finviz.com/quote.ashx?t="&B1,
"//table[@id='news-table']/tr"),,2))})
我正在使用 google 表 IMPORTXML 函数抓取 FINVIZ 财务数据,具体而言:
=IMPORTXML("http://finviz.com/quote.ashx?t="&B1,"//table[@id='news-table']/tr")
针对以下来源:
<table width="100%" cellpadding="1" cellspacing="0" border="0" id="news-table" class="fullview-news-outer">
<tr>
<td width="130" align="right" style="white-space:nowrap">Feb-15-20 03:58PM </td>
<td align="left"><a href="https://finance.yahoo.com/news/u-evacuate-citizens-quarantined-ship-043646253.html" target="_blank" class="tab-link-news">U.S. Woman From Cruise Falls Ill as 2,200 Head Home: Virus Update</a> <span style="color:#aa6dc0;font-size:9px">Bloomberg</span></td>
</tr>
<tr>
<td width="130" align="right">03:41PM </td>
<td align="left"><a href="https://www.marketwatch.com/story/afraid-of-sky-high-stock-valuations-consider-this-deep-value-strategy-2020-02-12?siteid=yhoof2&yptr=yahoo" target="_blank" class="tab-link-news">Afraid of sky-high stock valuations? Consider this deep value strategy</a> <span style="color:#aa6dc0;font-size:9px">MarketWatch</span></td>
</tr>
<tr>
<td width="130" align="right">10:47AM </td>
<td align="left"><a href="https://www.marketwatch.com/story/if-you-could-buy-only-one-stock-for-5g-and-artificial-intelligence-this-would-be-it-2020-02-14?siteid=yhoof2&yptr=yahoo" target="_blank" class="tab-link-news">If you could buy only one stock for 5G and artificial intelligence, this would be it</a> <span style="color:#aa6dc0;font-size:9px">MarketWatch</span></td>
</tr>
</table>
因此,如果我选择 Apple (AAPL) 的股票代码,则 IMPORTXML 的 XPATH 组件调用上面 returns 以下内容:
问题:如何修改 XPATH 组件以使新闻描述可点击其 HREF?
我不希望 URL 替换新闻 - 只希望新闻指向其目的地,这样点击新闻就会将我带到 link。
尝试:
=ARRAYFORMULA({INDEX(IMPORTXML("http://finviz.com/quote.ashx?t="&B1,
"//table[@id='news-table']/tr"),,1),
HYPERLINK(IMPORTXML("http://finviz.com/quote.ashx?t="&B1,
"//table[@id='news-table']/tr//a/@href"),
INDEX(IMPORTXML("http://finviz.com/quote.ashx?t="&B1,
"//table[@id='news-table']/tr"),,2))})