I'm trying to import portions of this data table into a spreadsheet in order to reference it for other sheets. I've been able to get the text of the table using the =IMPORTHTML
formula, but to my understanding the only way to import the images besides manually using =IMAGE()
for each entry (which I'd like to avoid if possible since the table has around 400 entries) is to use =IMPORTXML
, which I've been having difficulties with since I'm unfamiliar with the XML format.
我正在尝试将此数据表的一部分导入到电子表格中,以便在其他表格中引用它。我已经能够使用=IMPORTHTML公式获得表的文本,但据我所知,除了为每个条目手动使用=IMAGE()(如果可能的话,我希望避免这样做,因为表大约有400个条目),导入图像的唯一方法是使用=IMPORTXML,因为我不熟悉XML格式。
Here's the formula I'm using for the text portions of the table, since I only need data from a few columns: =QUERY(ImportHtml("https://nookipedia.com/wiki/Villager/New_Leaf", "table", 1), "SELECT Col2,Col3,Col5")
下面是我用于表格文本部分的公式,因为我只需要几列中的数据:=QUERY(ImportHtml(“https://nookipedia.com/wiki/Villager/New_Leaf”,“TABLE”,1),“SELECT COL2,COL3,COL5”)
I was able to find a very similar question that had this solution by majinnaibu:
我找到了一个非常相似的问题,它的解决方案是由majinnaibu提出的:
ArrayFormula(
Image(
ImportXML(
"https://bulbapedia.bulbagarden.net/wiki/List_of_Pok%C3%A9mon_by_Hisui_Pok%C3%A9dex_number",
"/html/body/div/div/div/div/div/div/table[2]/tbody/tr//td/following-sibling::th/a/img/@src"
),
4,
64,
64
)
)
I tested this in my sheet and it worked with the Pokémon images, but I've been struggling to find the XPath query I need for the images I'm trying to use. That's the part I need help with.
我在我的工作表中测试了这一点,它与神奇宝贝图像,但我一直在努力找到我想要使用的图像所需的查询。这就是我需要帮助的部分。
更多回答
I have to apologize for my poor English skill. Unfortunately, I cannot understand your question. Can I ask you about the details of your expected value? First, I would like to correctly understand your question.
我不得不为我糟糕的英语水平道歉。不幸的是,我听不懂你的问题。我能问一下你的期望值的详细情况吗?首先,我想正确理解你的问题。
优秀答案推荐
Try this:
试试这个:
=QUERY({QUERY({IMPORTXML("https://nookipedia.com/wiki/Villager/New_Leaf","//img[contains(@src,'Texture')]/@alt"),IMPORTXML("https://nookipedia.com/wiki/Villager/New_Leaf","//img[contains(@src,'Texture')]/@src")},"select Col1, Col2 label Col1 'Image name', Col2 'URL'"),QUERY({ImportHtml("https://nookipedia.com/wiki/Villager/New_Leaf", "table", 1)}, "SELECT Col2,Col3,Col5")},"select Col1, Col2, Col3, Col4, Col5")
=QUERY({QUERY({IMPORTXML(“https://nookipedia.com/wiki/Villager/New_Leaf”,“//img[包含(@src,‘纹理’)]/@alt”),IMPORTXML(“https://nookipedia.com/wiki/Villager/New_Leaf”,“//img[包含(@src,‘纹理’)]/@src”)},“选择COL1,COL2标签COL1‘图像名称’,COL2‘URL’”),QUERY({ImportHtml(“https://nookipedia.com/wiki/Villager/New_Leaf”,“表”,1)},“SELECT COL2,COL3,COL5”)},“选择COL1,COL2,COL3,COL4,COL5”)
The answer consists of two nested QUERY/IMPORTXML
& QUERY/IMPORTHTML
.
答案由两个嵌套的查询/IMPORTXML&Query/IMPORTHTML组成。
RESULTS - Extract
结果-摘录
更多回答
我是一名优秀的程序员,十分优秀!