Google Sheets ImportXML 以显示标题并嵌入 URL
Google Sheets ImportXML to display Headlines and embed the URL
在 Google 工作表 ImportXML
中,我希望显示标题并成为 link 以供点击。
下面的代码只为我们提供了 URL。
如果我删除 //a/@href
它只会给我文本。有什么方法可以将两者结合起来吗?
=QUERY(IMPORTXML("https://www.marketbeat.com/stocks/NASDAQ/ALLK/news/","//div[@id='dvHeadlines']/table//a/@href"),"SELECT * LIMIT 10")
试试这个:
=ARRAYFORMULA(HYPERLINK(UNIQUE(
QUERY(IMPORTXML("https://www.marketbeat.com/stocks/NASDAQ/ALLK/news/",
"//div[@id='dvHeadlines']/table//a/@href"), "limit 10")),
QUERY(IMPORTXML("https://www.marketbeat.com/stocks/NASDAQ/ALLK/news/",
"//div[@id='dvHeadlines']/table//a"), "where Col1 is not null limit 5")))
新行修复:
=ARRAYFORMULA(HYPERLINK(UNIQUE(
QUERY(IMPORTXML("https://www.marketbeat.com/stocks/NASDAQ/ALLK/news/",
"//div[@id='dvHeadlines']/table//a/@href"), "limit 10")),
REGEXREPLACE(QUERY(IMPORTXML("https://www.marketbeat.com/stocks/NASDAQ/ALLK/news/",
"//div[@id='dvHeadlines']/table//a"), "where Col1 is not null limit 5"), "\n", )))
在 Google 工作表 ImportXML
中,我希望显示标题并成为 link 以供点击。
下面的代码只为我们提供了 URL。
如果我删除 //a/@href
它只会给我文本。有什么方法可以将两者结合起来吗?
=QUERY(IMPORTXML("https://www.marketbeat.com/stocks/NASDAQ/ALLK/news/","//div[@id='dvHeadlines']/table//a/@href"),"SELECT * LIMIT 10")
试试这个:
=ARRAYFORMULA(HYPERLINK(UNIQUE(
QUERY(IMPORTXML("https://www.marketbeat.com/stocks/NASDAQ/ALLK/news/",
"//div[@id='dvHeadlines']/table//a/@href"), "limit 10")),
QUERY(IMPORTXML("https://www.marketbeat.com/stocks/NASDAQ/ALLK/news/",
"//div[@id='dvHeadlines']/table//a"), "where Col1 is not null limit 5")))
新行修复:
=ARRAYFORMULA(HYPERLINK(UNIQUE(
QUERY(IMPORTXML("https://www.marketbeat.com/stocks/NASDAQ/ALLK/news/",
"//div[@id='dvHeadlines']/table//a/@href"), "limit 10")),
REGEXREPLACE(QUERY(IMPORTXML("https://www.marketbeat.com/stocks/NASDAQ/ALLK/news/",
"//div[@id='dvHeadlines']/table//a"), "where Col1 is not null limit 5"), "\n", )))