将XML提要导入Google工作表
我有一个XML提要,看起来像这样将XML提要导入Google工作表,xml,google-apps-script,google-sheets,google-sheets-formula,Xml,Google Apps Script,Google Sheets,Google Sheets Formula,我有一个XML提要,看起来像这样 <rss xmlns:g="http://base.google.com/ns/1.0" version="2.0"> <channel> <title>Name of store</title> <link>Link to store</link> <description>Google Merchant Center product feed<
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
<channel>
<title>Name of store</title>
<link>Link to store</link>
<description>Google Merchant Center product feed</description>
<item>
<title>Producttitle</title>
<link> </link>
<description> </description>
<g:id> </g:id>
<g:condition> </g:condition>
<g:price> </g:price>
<g:availability> </g:availability>
<g:image_link> </g:image_link>
<g:gtin> </g:gtin>
<g:brand> </g:brand>
<g:product_type> </g:product_type>
</item>
它适用于标题、链接和描述,但我无法将g:*放入表格中。这给了我一个不适用的回答
有人能帮我一下吗:-)尝试通过不带名称空间的名称访问属性
看一看好的。我得到了工作的机会。要导入属性,我使用以下代码
SpreadsheetApp.getActiveSpreadsheet().getRange('B2').setValue('=importxml("URL2Feed";"//item//title")')
IMPORTXML("https://URL2FEED";"//*[local-name()='id']")
我将此代码输入A2、B2、C2等,但某些字段没有文本。这是一个来自商店的productfeed,然后价格与错误的产品相邻
所以现在我需要一个能够正确解析这个提要的脚本:-)