https://github.com/be-lenka/feed-sifter
Go from XML to CSV in an instant! Easily transform and reduce your XML feed to CSV, powered by PowerShell!
https://github.com/be-lenka/feed-sifter
feed google-feed xml xml-converter xml-parser
Last synced: about 1 year ago
JSON representation
Go from XML to CSV in an instant! Easily transform and reduce your XML feed to CSV, powered by PowerShell!
- Host: GitHub
- URL: https://github.com/be-lenka/feed-sifter
- Owner: be-lenka
- License: mit
- Created: 2025-05-27T06:40:52.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-05-27T14:50:54.000Z (about 1 year ago)
- Last Synced: 2025-05-27T15:28:38.745Z (about 1 year ago)
- Topics: feed, google-feed, xml, xml-converter, xml-parser
- Language: PowerShell
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ποΈ feed-sifter
**feed-sifter** is a lightweight, cross-platform `PowerShell` script that converts structured `XML` product feeds into flat `CSV` files.
Itβs ideal for B2B/B2C product data processing, price list extraction, or automated data transformation tasks.
---
## π Features
- β
Reads XML feeds from a remote **URL**
- β
Extracts **nested fields** (like `selling_prices`) and **root fields**
- β
Centralized configuration for feed structure
- β
Outputs clean `UTF-8` encoded `CSV`
- β
Runs on **Windows**, **macOS**, and **Linux** (via `PowerShell Core`)
---
## π¦ Requirements
On Windows, `PowerShell` should be installed by default.
- Windows
- On Windows: Download from https://github.com/PowerShell/PowerShell
- PowerShell Core (`pwsh`)
- On macOS/Linux: `brew install --cask powershell`
---
## π§ Usage
### πͺ Windows
```powershell
# For a CSV output
.\SiftFeedWHeader.ps1 -xmlUrl "https://example.com/path/to/feed.xml"
# For a XML output
.\SiftFeedXml.ps1 -xmlUrl "https://example.com/path/to/feed.xml"
```
### ο£Ώ MacOS
```bash
# For a CSV output
pwsh ./SiftFeedWHeader.ps1 -xmlUrl "https://example.com/path/to/feed.xml"
# For a XML output
pwsh ./SiftFeedXml.ps1 -xmlUrl "https://example.com/path/to/feed.xml"
```
### Parameters
| Parameter | Description |
|----------|-------------|
| `-xmlUrl` | **(Required)** URL of the remote XML feed you want to process |
---
## π§ Feed Structure Configuration
Inside the script, you can easily configure the feed structure:
```powershell
$feedStructure = @{
# XML path to repeating items
rootPath = "//item"
nestedRepeats = @{
# nested arrays
selling_prices = @("currency", "base_price", "discount_price")
}
# root-level fields
flatFields = @("ean", "availability", "availability_count")
}
```
Just modify the `flatFields` or `nestedRepeats` arrays to match your `XML` feed layout.
---
## π Output
The resulting `output.csv` file will be written to the script's current working directory.
It contains headers and all mapped values from the `XML` feed.
Example output:
```csv
ean,availability,availability_count,currency,base_price,discount_price
20000000025,in stock,14,CZK,2500,1999
...
```
---
## π‘ Tips
- Works with `HTTPS` feeds and requires no authentication.
- To change output file name or encoding, modify the `$outputPath` and `Set-Content`/`Add-Content` lines.
- You can redirect output to a timestamped file for batch jobs.
---
## π Execution Policy Troubleshooting
If you're running the script and see an error like:
```text
File cannot be loaded because running scripts is disabled on this system.
```
This means PowerShell's **execution policy** is blocking script execution.
### β
Temporary Fix (Safe for Local Use)
Run this in your current terminal session **before executing the script**:
```powershell
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
```
---
## π License
MIT β free to use, modify, and distribute.
Feel free to fork and contribute!
---
## β¨ Credits
Built with π by [BeLenka X Barebarics](https://github.com/be-lenka)
Inspired by real-world XML product feed challenges.