Skip to content

Library Guides

XML to CSV: how to convert a product feed, and back

When a seller needs XML to CSV or CSV to XML, why product XML is hard to flatten, the rules a free converter applies and the feed file formats Google accepts.

By CentralUpdated 23 November 202611 min read14 sources, checked 23 November 2026
On this page
  1. Which direction you need
  2. Why product XML is hard to flatten
  3. The rules the free converter applies
  4. CSV to XML: the way back
  5. The file formats Google Merchant Center accepts
  6. Encoding and delimiter pitfalls
  7. How to check the result
  8. JSON and JSON lines for ChatGPT's feed
  9. Where Central helps

In short

  • A product feed in XML holds nested elements, repeated elements, attributes and namespace prefixes such as g:, and a CSV table has a place for none of them.
  • Central's free product file converter turns nested fields into dotted column names such as shipping.country and joins repeated values with a vertical bar; the file is read in the browser and not uploaded.
  • Google Merchant Center accepts product files as tab-delimited .txt or .tsv files and as .xml files in RSS 2.0 or Atom 1.0, each up to 4 GB (as of November 2026).
  • In a Google XML feed, every attribute from Google's namespace needs the g: prefix and the declaration xmlns:g="http://base.google.com/ns/1.0", or Google ignores the attribute and its value.
  • Google lists saving a file in an encoding other than UTF-8 or UTF-16 among the common reasons a product file fails to process.
  • OpenAI's product feed schema for ChatGPT gives formatting rules for CSV, TSV and JSONL files, with each complete record on one line in a JSONL file.
Product file converterFree tool

Which direction you need#

The source decides the format you get, the destination decides the format you need. Both directions come up in the same shop:

SituationYou haveYou need
A supplier or distributor sends its catalog as XMLXMLCSV or Excel for your shop's import
A price comparison site or a feed plugin writes your listings as XML and you want to check themXMLA table you can sort and filter
A channel asks for an XML feed and your shop exports CSVCSVXML in the channel's schema
You have a Google feed and want to send products to ChatGPTXML or tab-delimited textCSV, TSV or JSON lines

People work in tables; many systems write XML. The product file converter near the top of this page does both directions in your browser. The rest of this page explains what happens to your data on the way, so that you can check the result. What to do with a supplier's file once it is a table is covered in product data onboarding.

Why product XML is hard to flatten#

A CSV file is a grid: one row per product, one cell per value. XML is a tree. Four things in that tree have no place in a grid:

In the XMLExampleThe problem in a table
Nested elements<g:shipping> holding <g:country>, <g:service> and <g:price>One element holds three values
Repeated elementsTwo <g:additional_image_link> elementsOne name, several values
Attributes<link href="https://www.northpeak.example/stove"/> in an Atom feedThe value sits inside the tag, not between two tags
NamespacesThe g: in <g:price>The same field can arrive as price or as g:price

A namespace says whose vocabulary an element belongs to. The W3C's Namespaces in XML identifies a namespace by a URI; the prefix is only a placeholder for it. A Google feed declares xmlns:g="http://base.google.com/ns/1.0". Google's RSS 2.0 specification says attributes from its namespace must carry the prefix, or they and their values are ignored. RSS itself brings three elements at item level: title, link and description.

Here is one product from a Google feed, a Northpeak camping stove with two extra images and a shipping rate:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">
<channel>
<title>Northpeak</title>
<link>https://www.northpeak.example</link>
<description>Northpeak product feed</description>
<item>
<g:id>NP-CS-01</g:id>
<title>Northpeak Ridge Camping Stove, 1 Burner</title>
<link>https://www.northpeak.example/ridge-stove</link>
<g:price>59.00 USD</g:price>
<g:availability>in_stock</g:availability>
<g:image_link>https://www.northpeak.example/img/stove.jpg</g:image_link>
<g:additional_image_link>https://www.northpeak.example/img/stove-side.jpg</g:additional_image_link>
<g:additional_image_link>https://www.northpeak.example/img/stove-in-use.jpg</g:additional_image_link>
<g:shipping>
<g:country>US</g:country>
<g:service>Standard</g:service>
<g:price>6.90 USD</g:price>
</g:shipping>
</item>
</channel>
</rss>

And the same product as CSV, the way the converter writes it:

id,title,link,price,availability,image_link,additional_image_link,shipping.country,shipping.service,shipping.price
NP-CS-01,"Northpeak Ridge Camping Stove, 1 Burner",https://www.northpeak.example/ridge-stove,59.00 USD,in_stock,https://www.northpeak.example/img/stove.jpg,https://www.northpeak.example/img/stove-side.jpg | https://www.northpeak.example/img/stove-in-use.jpg,US,Standard,6.90 USD

Three things happened. The g: prefix is gone. The two extra images share one cell, joined with a vertical bar. The shipping block became three columns with dotted names. The title is in double quotes because it contains a comma. The feed's own title, link and description in the channel block describe the feed, not a product, so they are not in the table.

The rules the free converter applies#

  • It reads the file in your browser. CSV and TSV with a comma, semicolon, tab or vertical bar as the separator (it picks the one that occurs most in the first lines), Excel workbooks (.xlsx, the first sheet), JSON, JSON lines and XML. Nothing is uploaded.
  • It finds the product elements. In an RSS feed these are the item elements, in an Atom feed the entry elements. In other XML it takes the element with child elements that repeats most often.
  • Namespace prefixes are dropped. g:price becomes the column price.
  • Nested fields become dotted column names. g:country inside g:shipping becomes shipping.country.
  • Repeated values are joined with a vertical bar. Two image elements become one cell with | between the links.
  • It reads element text, not attributes. A value that exists only as an attribute, such as the href of an Atom link, does not arrive in the table. Look for columns that came out empty.
  • It writes what you pick. CSV with commas or semicolons, TSV, Excel, JSON, JSON lines, plain XML, a Google feed as XML, or a Markdown table. In CSV output, a value that contains the separator, a double quote or a line break is put in double quotes.

CSV to XML: the way back#

When a channel wants XML and your shop exports a table, load the table and save it as "Google feed XML". The converter then writes an RSS 2.0 file with the g: namespace declared:

  1. Every row becomes one item.
  2. Every column becomes one element with the g: prefix. title, link and description stay without it.
  3. A cell with values joined by | becomes one element per value, which is how Google wants extra images in XML.
  4. Empty cells are left out, and &, < and > are escaped.

The column names must already be Google's, as listed in Google's product data specification. For shop exports, the converter has presets that rename columns: see the guides to the Shopify product CSV and the WooCommerce product CSV.

Two things the converter does not do on the way back. A dotted column such as shipping.country is not rebuilt into a nested g:shipping block, so set shipping in Merchant Center or write that block yourself. And the channel block gets a title only, while Google's sample file also gives the feed a link and a description; add them before you submit the file.

The plain "XML" output is for systems that take generic XML: a products root, one product element per row and one element per column.

The file formats Google Merchant Center accepts#

As of November 2026, Google's page Create a product file for Merchant Center names two kinds of product file: a tab-delimited spreadsheet or XML.

FormatExtensionWhat Google states
Tab-delimited text.txt, .tsvThe first line holds the attribute names, then one product per line, values separated by tabs
XML.xmlRSS 2.0 or Atom 1.0; the file name must end in .xml
Compressed.gz, .zip, .bz2Must contain a .txt or .xml file; Google's troubleshooting page adds: exactly one file per archive, smaller than 500 MB
Not accepted.xls, .htmlGoogle does not allow .xls files and names .html, .pdf and directly uploaded .xlsx files as formats that stop processing

More rules from the same pages:

  • Size. A product file can be up to 4 GB.
  • Encoding. Google lists an encoding other than UTF-8 or UTF-16 among the common processing errors.
  • No extension. A file name without an extension is processed as tab-delimited.
  • CSV. A .csv extension is not on the list. Google's price attribute page does head its text example "Text (TSV or CSV) data sources", but the file pages document tabs. Save a table as tab-delimited text.
  • Several values in a text file. Google's page on tab-delimited data sources separates repeated values with commas and sub-attributes with colons. Extra images are up to 10 links, separated by commas in a text file and written as repeated elements in XML. After converting XML to a text file for Google, replace the vertical bars between image links with commas.
  • Inside a value. No tabs or line breaks inside a value and no trailing tabs in a text file; no capital letters in XML attribute names.

How to set a file up in Merchant Center and keep it current is the subject of the guides to the Google Shopping feed and to product feed management.

Encoding and delimiter pitfalls#

PitfallWhat goes wrongWhat to do
EncodingAccents and umlauts turn into odd charactersSave as UTF-8. The XML specification obliges every XML processor to read UTF-8 and UTF-16. A file in another encoding must say so in its first line.
Byte order markAn invisible mark sits before the first character of the fileThe XML specification allows it in UTF-8 files and requires it in UTF-16 files. RFC 8259 says JSON sent between systems must not start with one. If an import cannot find the first column, look for this mark. The converter removes it when it reads a CSV.
SemicolonsA whole row lands in one columnExcel takes its list separator from the Windows region settings, says Microsoft. Pick the separator the destination wants when you save.
Decimal comma59,00 splits into two cells in a comma-separated file, or the price is refusedWrite prices with a period. Google's price examples read 15.00 USD: a number, then the ISO 4217 currency code.
QuotesA title with a comma or an inch mark breaks the rowRFC 4180 puts fields with commas, line breaks or double quotes in double quotes and doubles a quote inside a field.
& and < in XMLThe file cannot be read at allThe XML specification allows both only as markup. Write &amp; and &lt;. Google's troubleshooting page says the same about &.
Barcodes as numbersLeading zeros vanish, long numbers show as 1.23E+15Microsoft says Excel removes leading zeros and converts large numbers to scientific notation. Format the column as text before the data goes in.

How to check the result#

  1. Count. The table has as many rows as the XML has product elements, and the XML you wrote has as many items as the table has rows.
  2. Open the file in a text editor, not by double-click in a spreadsheet program, and look at the first three lines: header, separator, quotes.
  3. Check the IDs. Every row has one and no ID appears twice.
  4. Check the barcodes. Paste the column into the GTIN check digit calculator, which checks a whole column at once.
  5. Look at cells with a vertical bar. Decide what the destination wants there: commas, repeated elements or separate columns.
  6. Run the file through a checker. The product feed checker reads the converted file and checks it against Google's, Microsoft's or ChatGPT's feed rules.
Product feed checkerFree tool

A file that passes a format check can still carry weak data. How to measure that is covered in product data quality.

JSON and JSON lines for ChatGPT's feed#

OpenAI's product feed schema gives formatting rules for CSV, TSV and JSONL files. A JSON lines file has one complete record per line and no surrounding array, and lists are real arrays. A shortened record:

{"item_id":"NP-CS-01","title":"Northpeak Ridge Camping Stove, 1 Burner","price":"59.00 USD","target_countries":["US"],"additional_image_urls":["https://www.northpeak.example/img/stove-side.jpg"]}

In a CSV or TSV file the same structures go into one cell: OpenAI asks for a list of image links as one comma-separated string and for objects serialized as JSON. Text is UTF-8, identifiers stay strings so leading zeros survive, and a cell with commas, quotes or line breaks is quoted.

The converter's preset "Google feed to ChatGPT feed (OpenAI)" renames id to item_id, link to url and image_link to image_url, writes pre_order where Google writes preorder, and adds the columns seller_name (empty, for you to fill), target_countries and store_country (both set to the US). It writes every value as text. In a CSV or TSV file that is what OpenAI's rules describe. In a JSON lines file, list fields such as target_countries still have to become real arrays, so CSV or TSV is the shorter way.

Which fields ChatGPT's feed needs is covered in the guide to the ChatGPT Shopping product feed; the comparison of Google's, Microsoft's and ChatGPT's feeds shows where the three differ. The ChatGPT Shopping feed checker checks the finished file.

Where Central helps#

Converting a file changes its shape, not its content: a GTIN that was missing in the XML is still missing in the CSV. Central researches the product data a listing needs from your own data, the open web and verified databases, backs every value with sources you can check and holds back what the sources do not support. It then writes titles, descriptions and attributes within each channel's limits.

See it on your own products

Questions

How do I convert an XML product feed to CSV?

Load the XML file into a converter that understands repeated product elements, check that every product became one row, and save the table as CSV. Central's free product file converter does this in the browser: nested fields become dotted columns and repeated values are joined with a vertical bar.

Can Google Merchant Center read a CSV file?

Google's product file page lists tab-delimited .txt and .tsv files and .xml files, up to 4 GB. It does not list a .csv extension, so save a table as tab-delimited text before you add it to Merchant Center.

What does the g: in a Google XML feed mean?

It is a namespace prefix. The feed declares it once with xmlns:g="http://base.google.com/ns/1.0", and every Google attribute such as g:price or g:gtin carries it. Google says attributes without the prefix are ignored.

Why are accents and umlauts broken after converting?

The file was read or saved in the wrong character encoding. Save product files as UTF-8; Google names encodings other than UTF-8 and UTF-16 as a common cause of processing errors.

Is JSON lines the same as JSON?

No. A JSON file is usually one array that holds all records. A JSON lines file has no surrounding array: OpenAI's feed schema asks for each complete record on one line of the JSONL file.

Sources

  1. Create a product file for Merchant CenterGoogle Merchant Center Helpchecked 23 November 2026
  2. RSS 2.0 specificationGoogle Merchant Center Helpchecked 23 November 2026
  3. Atom 1.0 specificationGoogle Merchant Center Helpchecked 23 November 2026
  4. Create a tab-delimited product data sourceGoogle Merchant Center Helpchecked 23 November 2026
  5. Troubleshoot my data sourceGoogle Merchant Center Helpchecked 23 November 2026
  6. Additional image link [additional_image_link]Google Merchant Center Helpchecked 23 November 2026
  7. Price [price]Google Merchant Center Helpchecked 23 November 2026
  8. Extensible Markup Language (XML) 1.0 (Fifth Edition)W3Cchecked 23 November 2026
  9. Namespaces in XML 1.0 (Third Edition)W3Cchecked 23 November 2026
  10. RFC 4180: Common Format and MIME Type for Comma-Separated Values (CSV) FilesRFC Editorchecked 23 November 2026
  11. RFC 8259: The JavaScript Object Notation (JSON) Data Interchange FormatRFC Editorchecked 23 November 2026
  12. Product feed schemaOpenAI developer docschecked 23 November 2026
  13. Import or export text (.txt or .csv) filesMicrosoft Supportchecked 23 November 2026
  14. Keeping leading zeros and large numbersMicrosoft Supportchecked 23 November 2026

More on this topic

Product data and files
Start hereProduct data quality: how to measure and improve itWhat product data quality means for an online seller, six dimensions with a way to measure each on a product file, a scorecard to copy and the free tools.

You choose what goes in and where it goes out.

Central AI does everything in between. Your first 3 products are free.

  1. Your inputYour shop, your files or your product pages.
  2. Central AIResearches, verifies and writes everything in between. Every value is backed by sources you can check; what the sources do not support is held back.
  3. Your channelsProduct data and listings for the channels you choose.