需要帮助使用 Power Query 将 XML 导入 Excel
Need help importing XML into Excel with Power Query
在此先感谢您提供的任何帮助。我希望在 Power Query 中找到正确的设置以导入一些 Google 购物格式 XML。您可以在此处查看 XML 代码示例:
<?xml version="1.0"?>
<rss xmlns:g="http://base.google.com/ns/1.0" xmlns:c="http://base.google.com/cns/1.0" version="2.0">
<channel>
<title>Site anme</title>
<link><![CDATA[http://www.example.com/]]></link>
<description>Yada</description>
<language>EN</language>
<category>Fashion</category>
<image><url><![CDATA[http://cdn1.linl.com]]></url></image>
<currency>GBP</currency>
<item>
<title><![CDATA[Some product name]]></title>
<link><![CDATA[http://www.somelinke.com]]></link>
<g:image_link><![CDATA[http://cdn1.some.image.com]]></g:image_link>
<g:age_group>adult</g:age_group>
<g:item_group_id><![CDATA[10033]]></g:item_group_id>
<g:id><![CDATA[10033]]></g:id>
<g:gtin><![CDATA[0207140132]]></g:gtin>
<g:size><![CDATA[200]]></g:size>
<g:title><![CDATA[Title here]]></g:title>
<g:availability>in stock</g:availability>
<g:price>20.00 GBP</g:price>
<g:description><![CDATA[blah blah blah]]</g:description>
<g:mpn><![CDATA[61A0010000]]></g:mpn>
<g:brand><![CDATA[Brand]]></g:brand>
<g:condition><![CDATA[new]]></g:condition>
<g:product_type><![CDATA[Health & Beauty > Personal Care]]></g:product_type>
<g:colour><![CDATA[ ]]></g:colour>
<g:shipping>
<g:price>0.00</g:price>
</g:shipping>
<g:gender>unisex</g:gender>
<g:google_product_category><![CDATA[Health & Beauty]]></g:google_product_category>
<g:identifier_exists><![CDATA[TRUE]]></g:identifier_exists>
</item>
<item>
<title><![CDATA[Some product name]]></title>
<link><![CDATA[http://www.somelinke.com]]></link>
<g:image_link><![CDATA[http://cdn1.some.image.com]]></g:image_link>
<g:age_group>adult</g:age_group>
<g:item_group_id><![CDATA[10033]]></g:item_group_id>
<g:id><![CDATA[10033]]></g:id>
<g:gtin><![CDATA[0207140132]]></g:gtin>
<g:size><![CDATA[200]]></g:size>
<g:title><![CDATA[Title here]]></g:title>
<g:availability>in stock</g:availability>
<g:price>20.00 GBP</g:price>
<g:description><![CDATA[blah blah blah]]></g:description>
<g:mpn><![CDATA[61A0010000]]></g:mpn>
<g:brand><![CDATA[Brand]]></g:brand>
<g:condition><![CDATA[new]]></g:condition>
<g:product_type><![CDATA[Health & Beauty > Personal Care]]></g:product_type>
<g:colour><![CDATA[ ]]></g:colour>
<g:shipping>
<g:price>0.00</g:price>
</g:shipping>
<g:gender>unisex</g:gender>
<g:google_product_category><![CDATA[Health & Beauty]]></g:google_product_category>
<g:identifier_exists><![CDATA[TRUE]]></g:identifier_exists>
</item>
<item>
<title><![CDATA[Some product name]]></title>
<link><![CDATA[http://www.somelinke.com]]></link>
<g:image_link><![CDATA[http://cdn1.some.image.com]]></g:image_link>
<g:age_group>adult</g:age_group>
<g:item_group_id><![CDATA[10033]]></g:item_group_id>
<g:id><![CDATA[10033]]></g:id>
<g:gtin><![CDATA[0207140132]]></g:gtin>
<g:size><![CDATA[200]]></g:size>
<g:title><![CDATA[Title here]]></g:title>
<g:availability>in stock</g:availability>
<g:price>20.00 GBP</g:price>
<g:description><![CDATA[blah blah blah]]></g:description>
<g:mpn><![CDATA[61A0010000]]></g:mpn>
<g:brand><![CDATA[Brand]]></g:brand>
<g:condition><![CDATA[new]]></g:condition>
<g:product_type><![CDATA[Health & Beauty > Personal Care]]></g:product_type>
<g:colour><![CDATA[ ]]></g:colour>
<g:shipping>
<g:price>0.00</g:price>
</g:shipping>
<g:gender>unisex</g:gender>
<g:google_product_category><![CDATA[Health & Beauty]]></g:google_product_category>
<g:identifier_exists><![CDATA[TRUE]]></g:identifier_exists>
</item>
<item>
<title><![CDATA[Some product name]]></title>
<link><![CDATA[http://www.somelinke.com]]></link>
<g:image_link><![CDATA[http://cdn1.some.image.com]]></g:image_link>
<g:age_group>adult</g:age_group>
<g:item_group_id><![CDATA[10033]]></g:item_group_id>
<g:id><![CDATA[10033]]></g:id>
<g:gtin><![CDATA[0207140132]]></g:gtin>
<g:size><![CDATA[200]]></g:size>
<g:title><![CDATA[Title here]]></g:title>
<g:availability>in stock</g:availability>
<g:price>20.00 GBP</g:price>
<g:description><![CDATA[blah blah blah]]></g:description>
<g:mpn><![CDATA[61A0010000]]></g:mpn>
<g:brand><![CDATA[Brand]]></g:brand>
<g:condition><![CDATA[new]]></g:condition>
<g:product_type><![CDATA[Health & Beauty > Personal Care]]></g:product_type>
<g:colour><![CDATA[ ]]></g:colour>
<g:shipping>
<g:price>0.00</g:price>
</g:shipping>
<g:gender>unisex</g:gender>
<g:google_product_category><![CDATA[Health & Beauty]]></g:google_product_category>
<g:identifier_exists><![CDATA[TRUE]]></g:identifier_exists>
</item>
</channel>
</rss>
尽我所能,我找不到合适的方法来导入它。 Power Query 固定在开头部分。如果我完全删除它,那么 Power Query 将忽略任何
马特
我试过你的例子,在第 23 行关闭标签后成功导入。
<g:description><![CDATA[blah blah blah]]></g:description>
缺少 > 此处:
[CDATA[等等等等]]><
let
Source = Xml.Tables(File.Contents("C:\Users\User\Desktop\test.xml")),
ExpandTable = Table.ExpandTableColumn(Source, "channel", {"title", "link", "description", "language", "category", "image", "currency", "item"}, {"channel.title", "channel.link", "channel.description", "channel.language", "channel.category", "channel.image", "channel.currency", "channel.item"})
in
ExpandTable
嵌入的表格似乎也不错,也可以打开。
在此先感谢您提供的任何帮助。我希望在 Power Query 中找到正确的设置以导入一些 Google 购物格式 XML。您可以在此处查看 XML 代码示例:
<?xml version="1.0"?>
<rss xmlns:g="http://base.google.com/ns/1.0" xmlns:c="http://base.google.com/cns/1.0" version="2.0">
<channel>
<title>Site anme</title>
<link><![CDATA[http://www.example.com/]]></link>
<description>Yada</description>
<language>EN</language>
<category>Fashion</category>
<image><url><![CDATA[http://cdn1.linl.com]]></url></image>
<currency>GBP</currency>
<item>
<title><![CDATA[Some product name]]></title>
<link><![CDATA[http://www.somelinke.com]]></link>
<g:image_link><![CDATA[http://cdn1.some.image.com]]></g:image_link>
<g:age_group>adult</g:age_group>
<g:item_group_id><![CDATA[10033]]></g:item_group_id>
<g:id><![CDATA[10033]]></g:id>
<g:gtin><![CDATA[0207140132]]></g:gtin>
<g:size><![CDATA[200]]></g:size>
<g:title><![CDATA[Title here]]></g:title>
<g:availability>in stock</g:availability>
<g:price>20.00 GBP</g:price>
<g:description><![CDATA[blah blah blah]]</g:description>
<g:mpn><![CDATA[61A0010000]]></g:mpn>
<g:brand><![CDATA[Brand]]></g:brand>
<g:condition><![CDATA[new]]></g:condition>
<g:product_type><![CDATA[Health & Beauty > Personal Care]]></g:product_type>
<g:colour><![CDATA[ ]]></g:colour>
<g:shipping>
<g:price>0.00</g:price>
</g:shipping>
<g:gender>unisex</g:gender>
<g:google_product_category><![CDATA[Health & Beauty]]></g:google_product_category>
<g:identifier_exists><![CDATA[TRUE]]></g:identifier_exists>
</item>
<item>
<title><![CDATA[Some product name]]></title>
<link><![CDATA[http://www.somelinke.com]]></link>
<g:image_link><![CDATA[http://cdn1.some.image.com]]></g:image_link>
<g:age_group>adult</g:age_group>
<g:item_group_id><![CDATA[10033]]></g:item_group_id>
<g:id><![CDATA[10033]]></g:id>
<g:gtin><![CDATA[0207140132]]></g:gtin>
<g:size><![CDATA[200]]></g:size>
<g:title><![CDATA[Title here]]></g:title>
<g:availability>in stock</g:availability>
<g:price>20.00 GBP</g:price>
<g:description><![CDATA[blah blah blah]]></g:description>
<g:mpn><![CDATA[61A0010000]]></g:mpn>
<g:brand><![CDATA[Brand]]></g:brand>
<g:condition><![CDATA[new]]></g:condition>
<g:product_type><![CDATA[Health & Beauty > Personal Care]]></g:product_type>
<g:colour><![CDATA[ ]]></g:colour>
<g:shipping>
<g:price>0.00</g:price>
</g:shipping>
<g:gender>unisex</g:gender>
<g:google_product_category><![CDATA[Health & Beauty]]></g:google_product_category>
<g:identifier_exists><![CDATA[TRUE]]></g:identifier_exists>
</item>
<item>
<title><![CDATA[Some product name]]></title>
<link><![CDATA[http://www.somelinke.com]]></link>
<g:image_link><![CDATA[http://cdn1.some.image.com]]></g:image_link>
<g:age_group>adult</g:age_group>
<g:item_group_id><![CDATA[10033]]></g:item_group_id>
<g:id><![CDATA[10033]]></g:id>
<g:gtin><![CDATA[0207140132]]></g:gtin>
<g:size><![CDATA[200]]></g:size>
<g:title><![CDATA[Title here]]></g:title>
<g:availability>in stock</g:availability>
<g:price>20.00 GBP</g:price>
<g:description><![CDATA[blah blah blah]]></g:description>
<g:mpn><![CDATA[61A0010000]]></g:mpn>
<g:brand><![CDATA[Brand]]></g:brand>
<g:condition><![CDATA[new]]></g:condition>
<g:product_type><![CDATA[Health & Beauty > Personal Care]]></g:product_type>
<g:colour><![CDATA[ ]]></g:colour>
<g:shipping>
<g:price>0.00</g:price>
</g:shipping>
<g:gender>unisex</g:gender>
<g:google_product_category><![CDATA[Health & Beauty]]></g:google_product_category>
<g:identifier_exists><![CDATA[TRUE]]></g:identifier_exists>
</item>
<item>
<title><![CDATA[Some product name]]></title>
<link><![CDATA[http://www.somelinke.com]]></link>
<g:image_link><![CDATA[http://cdn1.some.image.com]]></g:image_link>
<g:age_group>adult</g:age_group>
<g:item_group_id><![CDATA[10033]]></g:item_group_id>
<g:id><![CDATA[10033]]></g:id>
<g:gtin><![CDATA[0207140132]]></g:gtin>
<g:size><![CDATA[200]]></g:size>
<g:title><![CDATA[Title here]]></g:title>
<g:availability>in stock</g:availability>
<g:price>20.00 GBP</g:price>
<g:description><![CDATA[blah blah blah]]></g:description>
<g:mpn><![CDATA[61A0010000]]></g:mpn>
<g:brand><![CDATA[Brand]]></g:brand>
<g:condition><![CDATA[new]]></g:condition>
<g:product_type><![CDATA[Health & Beauty > Personal Care]]></g:product_type>
<g:colour><![CDATA[ ]]></g:colour>
<g:shipping>
<g:price>0.00</g:price>
</g:shipping>
<g:gender>unisex</g:gender>
<g:google_product_category><![CDATA[Health & Beauty]]></g:google_product_category>
<g:identifier_exists><![CDATA[TRUE]]></g:identifier_exists>
</item>
</channel>
</rss>
尽我所能,我找不到合适的方法来导入它。 Power Query 固定在开头部分。如果我完全删除它,那么 Power Query 将忽略任何
马特
我试过你的例子,在第 23 行关闭标签后成功导入。
<g:description><![CDATA[blah blah blah]]></g:description>
缺少 > 此处:
[CDATA[等等等等]]><
let
Source = Xml.Tables(File.Contents("C:\Users\User\Desktop\test.xml")),
ExpandTable = Table.ExpandTableColumn(Source, "channel", {"title", "link", "description", "language", "category", "image", "currency", "item"}, {"channel.title", "channel.link", "channel.description", "channel.language", "channel.category", "channel.image", "channel.currency", "channel.item"})
in
ExpandTable
嵌入的表格似乎也不错,也可以打开。