Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将XML提要导入Google工作表_Xml_Google Apps Script_Google Sheets_Google Sheets Formula - Fatal编程技术网

将XML提要导入Google工作表

将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<

我有一个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</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,然后价格与错误的产品相邻

所以现在我需要一个能够正确解析这个提要的脚本:-)