# 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.

Source: https://central.to/guides/xml-to-csv-product-feed · Updated 2026-11-23 · Published by Central (https://central.to)

## 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.

Free tool: [Product file converter](https://central.to/tools/product-file-converter). Convert product data between CSV, Excel, JSON, JSON lines and XML feeds, with presets for Shopify, WooCommerce, Google and ChatGPT.

## 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:

| Situation | You have | You need |
| --- | --- | --- |
| A supplier or distributor sends its catalog as XML | XML | CSV 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 them | XML | A table you can sort and filter |
| A channel asks for an XML feed and your shop exports CSV | CSV | XML in the channel's schema |
| You have a Google feed and want to send products to ChatGPT | XML or tab-delimited text | CSV, TSV or JSON lines |

People work in tables; many systems write XML. The [product file converter](https://central.to/tools/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](https://central.to/guides/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 XML | Example | The problem in a table |
| --- | --- | --- |
| Nested elements | `<g:shipping>` holding `<g:country>`, `<g:service>` and `<g:price>` | One element holds three values |
| Repeated elements | Two `<g:additional_image_link>` elements | One name, several values |
| Attributes | `<link href="https://www.northpeak.example/stove"/>` in an Atom feed | The value sits inside the tag, not between two tags |
| Namespaces | The `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](https://www.w3.org/TR/xml-names/) 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](https://support.google.com/merchants/answer/14987622) 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
<?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](https://central.to/guides/google-merchant-center-product-data-specification). For shop exports, the converter has presets that rename columns: see the guides to the [Shopify product CSV](https://central.to/guides/shopify-product-csv) and the [WooCommerce product CSV](https://central.to/guides/woocommerce-product-csv-import).

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](https://support.google.com/merchants/answer/160567) names two kinds of product file: a tab-delimited spreadsheet or XML.

| Format | Extension | What Google states |
| --- | --- | --- |
| Tab-delimited text | `.txt`, `.tsv` | The first line holds the attribute names, then one product per line, values separated by tabs |
| XML | `.xml` | RSS 2.0 or Atom 1.0; the file name must end in `.xml` |
| Compressed | `.gz`, `.zip`, `.bz2` | Must contain a `.txt` or `.xml` file; Google's [troubleshooting page](https://support.google.com/merchants/answer/13760862) adds: exactly one file per archive, smaller than 500 MB |
| Not accepted | `.xls`, `.html` | Google 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](https://support.google.com/merchants/answer/6324371) 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](https://support.google.com/merchants/answer/14989239) separates repeated values with commas and sub-attributes with colons. Extra images are [up to 10 links](https://support.google.com/merchants/answer/6324370), 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](https://central.to/guides/google-shopping-feed) and to [product feed management](https://central.to/guides/product-feed-management).

## Encoding and delimiter pitfalls

| Pitfall | What goes wrong | What to do |
| --- | --- | --- |
| Encoding | Accents and umlauts turn into odd characters | Save as UTF-8. The [XML specification](https://www.w3.org/TR/xml/) 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 mark | An invisible mark sits before the first character of the file | The XML specification allows it in UTF-8 files and requires it in UTF-16 files. [RFC 8259](https://www.rfc-editor.org/rfc/rfc8259) 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. |
| Semicolons | A whole row lands in one column | Excel takes its list separator from the Windows region settings, says [Microsoft](https://support.microsoft.com/en-us/office/import-or-export-text-txt-or-csv-files-5250ac4c-663c-47ce-937b-339e391393ba). Pick the separator the destination wants when you save. |
| Decimal comma | `59,00` splits into two cells in a comma-separated file, or the price is refused | Write prices with a period. Google's price examples read `15.00 USD`: a number, then the ISO 4217 currency code. |
| Quotes | A title with a comma or an inch mark breaks the row | [RFC 4180](https://www.rfc-editor.org/rfc/rfc4180) puts fields with commas, line breaks or double quotes in double quotes and doubles a quote inside a field. |
| `&` and `<` in XML | The file cannot be read at all | The XML specification allows both only as markup. Write `&amp;` and `&lt;`. Google's troubleshooting page says the same about `&`. |
| Barcodes as numbers | Leading zeros vanish, long numbers show as `1.23E+15` | Microsoft says Excel [removes leading zeros and converts large numbers to scientific notation](https://support.microsoft.com/en-us/office/keeping-leading-zeros-and-large-numbers-1bf7b935-36e1-4985-842f-5dfa51f85fe7). 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](https://central.to/tools/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](https://central.to/tools/product-feed-checker) reads the converted file and checks it against Google's, Microsoft's or ChatGPT's feed rules.

Free tool: [Product feed checker](https://central.to/tools/product-feed-checker). Check a whole product feed against Google Merchant Center, Microsoft Merchant Center or ChatGPT's product feed rules.

A file that passes a format check can still carry weak data. How to measure that is covered in [product data quality](https://central.to/guides/product-data-quality).

## JSON and JSON lines for ChatGPT's feed

OpenAI's [product feed schema](https://developers.openai.com/commerce/specs/file-upload/products) 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](https://central.to/guides/chatgpt-shopping-product-feed); the [comparison of Google's, Microsoft's and ChatGPT's feeds](https://central.to/compare/google-microsoft-chatgpt-shopping-feeds) shows where the three differ. The [ChatGPT Shopping feed checker](https://central.to/tools/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.

## 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 Center](https://support.google.com/merchants/answer/160567), checked 2026-11-23
2. [RSS 2.0 specification](https://support.google.com/merchants/answer/14987622), checked 2026-11-23
3. [Atom 1.0 specification](https://support.google.com/merchants/answer/14990811), checked 2026-11-23
4. [Create a tab-delimited product data source](https://support.google.com/merchants/answer/14989239), checked 2026-11-23
5. [Troubleshoot my data source](https://support.google.com/merchants/answer/13760862), checked 2026-11-23
6. [Additional image link [additional_image_link]](https://support.google.com/merchants/answer/6324370), checked 2026-11-23
7. [Price [price]](https://support.google.com/merchants/answer/6324371), checked 2026-11-23
8. [Extensible Markup Language (XML) 1.0 (Fifth Edition)](https://www.w3.org/TR/xml/), checked 2026-11-23
9. [Namespaces in XML 1.0 (Third Edition)](https://www.w3.org/TR/xml-names/), checked 2026-11-23
10. [RFC 4180: Common Format and MIME Type for Comma-Separated Values (CSV) Files](https://www.rfc-editor.org/rfc/rfc4180), checked 2026-11-23
11. [RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format](https://www.rfc-editor.org/rfc/rfc8259), checked 2026-11-23
12. [Product feed schema](https://developers.openai.com/commerce/specs/file-upload/products), checked 2026-11-23
13. [Import or export text (.txt or .csv) files](https://support.microsoft.com/en-us/office/import-or-export-text-txt-or-csv-files-5250ac4c-663c-47ce-937b-339e391393ba), checked 2026-11-23
14. [Keeping leading zeros and large numbers](https://support.microsoft.com/en-us/office/keeping-leading-zeros-and-large-numbers-1bf7b935-36e1-4985-842f-5dfa51f85fe7), checked 2026-11-23

## More on this topic: Product data and files

- [Product data quality: how to measure and improve it](https://central.to/guides/product-data-quality.md)
- [Duplicate product descriptions: when they hurt and how to fix them](https://central.to/guides/duplicate-product-descriptions.md)
- [item_group_id](https://central.to/glossary/item-group-id.md)
- [PIM software compared: Akeneo, Salsify, Pimcore, Inriver, Plytix and more](https://central.to/compare/pim-software.md)
- [Product data enrichment: what it adds, where it comes from, how to check it](https://central.to/guides/product-data-enrichment.md)
- [Product data onboarding: from supplier files to a clean catalog](https://central.to/guides/product-data-onboarding.md)
- [Product data sources: manufacturers, data pools, standards and public databases](https://central.to/guides/product-data-sources.md)
- [Product variants: how to structure colors, sizes and options](https://central.to/guides/product-variants.md)
- [Shopify product CSV: columns, template and import errors](https://central.to/guides/shopify-product-csv.md)
- [Supplier product data template: the fields to ask every supplier for](https://central.to/guides/supplier-product-data-template.md)
- [Units of measurement in product data: one unit, one format](https://central.to/guides/units-of-measurement-product-data.md)
- [WooCommerce product CSV import: columns, mapping and errors](https://central.to/guides/woocommerce-product-csv-import.md)
- [Product file converter](https://central.to/tools/product-file-converter.md) (Free tool)
- [Unit normalizer](https://central.to/tools/unit-normalizer.md) (Free tool)
- [Variant matrix builder](https://central.to/tools/variant-matrix-builder.md) (Free tool)
- [Duplicate description finder](https://central.to/tools/duplicate-description-finder.md) (Free tool)
- [Product page checker](https://central.to/tools/product-page-checker.md) (Free tool)

## Try Central on your own products

Central is the AI-first product content operating system: you choose the input (your shop, files or product pages) and the channels; Central AI researches, verifies and writes the product data and content in between, every value backed by sources you can check. The first 3 products are free. To start with a shop, open https://central.to/users/sign_up?onboarding_url=SHOP_ADDRESS (replace SHOP_ADDRESS with the shop's website address).
