Convert XML to CSV
Learn how to convert XML files into CSV files using a Convert XML to CSV data operation.
The Convert XML to CSV data operation allows you to retrieve all the information contained in a possibly complex XML file into a set of CSV files, all located in a Google Cloud Storage bucket. You can later convert your CSV files into database tables using a Storage to Tables data operation.
Note that the XML file provided must be well-formed and valid against a matching XSD file (defining its elements and attributes, and the rules that apply to them).
The XML and XSD file must have the same name (suffix excluded). Refer to this page for more details.
If the XML file contains entities not set in the XSD, then the corresponding data will not be exported to CSV files.
- XML + XSD file pair(s)
- Multiple TSV (Tab Separated Values) + DDL file pairs
Every time a new file matching the specified XML file name pattern appears in a given directory of a Google Cloud Storage bucket:
- The XML file is checked against the matching XSD file.
- If the XML file is valid, the conversion process is launched.
- A set of CSV files with their matching DDL files (describing their schema) is generated in the working directory.
- The source XML files are deleted from the working directory.
- If set, a filtering occurs at the end of the process to remove unwanted CSV files.
- 2.Create a working folder as you want, and create a JSON file for your data operation inside.
- 3.Place the XSD file in the same location as your JSON file.
- 5.Access your working folder by running the following command:cd "[path to your working folder]"
- 6.To deploy the data operation, run the following command:tailer deploy configuration your-configuration.json
- 8.For your Convert XML to CSV data operation to be executed, you need to place a file into the source folder.
- 9.Access the GCS bucket to check your output files (CSV and DDL files).