# Sitemap to CSV: export the URLs of a sitemap XML

**Use case:** 

Enter a sitemap address and export its URLs to CSV, Excel or JSON, with lastmod, changefreq and priority when the sitemap lists them. This example reads the first of the GitHub Blog's post sitemaps: about 1,000 older posts, with no changefreq or priority. Sitemap indexes, .gz files and .xml, .rss or .atom feeds work too. The task stops at 5,000 URLs; raise Max URLs per run for more.

## Input

```json
{
  "startUrls": [
    "https://github.blog/post-sitemap.xml"
  ],
  "maxUrls": 5000,
  "maxUrlsPerSite": 0,
  "keepUrlsWithoutLastmod": false,
  "sameSiteOnly": false,
  "onlyNewUrls": false,
  "baselineOnFirstRun": true,
  "includeImageUrls": false,
  "includeAlternates": true,
  "maxSitemapDepth": 5,
  "maxConcurrency": 10,
  "requestTimeoutSecs": 30
}
```

## Output

```json
{
  "url": {
    "label": "URL",
    "format": "string"
  },
  "lastmod": {
    "label": "Last modified",
    "format": "string"
  },
  "changefreq": {
    "label": "Change frequency",
    "format": "string"
  },
  "priority": {
    "label": "Priority",
    "format": "number"
  },
  "imageCount": {
    "label": "Images",
    "format": "integer"
  },
  "sitemapUrl": {
    "label": "Found in sitemap",
    "format": "string"
  },
  "isNew": {
    "label": "New",
    "format": "boolean"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The Sitemap Extractor & URL Finder Actor is ready to run with the inputs already set for "Sitemap to CSV: export the URLs of a sitemap XML". [Sign up or log in](https://console.apify.com/create-task-from-example/5WlWhH57uoVWjXtuh) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Sitemap to CSV: export the URLs of a sitemap XML" task

The Sitemap Extractor & URL Finder Actor will start running based on the input automatically. You can also change all the input fields, like websites or sitemap urls, max urls per run, and more, to match your specific use case.

### 3. Receive the "Sitemap to CSV: export the URLs of a sitemap XML" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as URL, last modified, change frequency, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Sitemap to CSV: export the URLs of a sitemap XML" task via API](https://apify.com/urameshi7k/sitemap-extractor.md).

## FAQ

### What data does this task return when exporting a sitemap?

Each row has the URL, last-modified date, image count and the sitemap it came from, plus change frequency and priority when the sitemap lists them (this GitHub Blog sitemap does not). With Only new URLs turned on, items are also marked isNew.

### How does the task filter URLs from a sitemap?

Include or exclude URLs with regular expressions, read only the sitemaps whose address matches a pattern, or keep URLs modified after or before a date.

### What URL can I use as input for this task?

You can enter a sitemap address like 'https://github.blog/post-sitemap.xml' to extract URLs from that specific sitemap.

### Can I schedule this task to run automatically?

Yes, this task can be scheduled to run automatically at specified intervals through the Apify Console.

### What formats can I export the URLs to?

The exported URLs can be saved in CSV, Excel, or JSON formats depending on your needs.

### Does this task monitor for new URLs?

Not by default. Turn on Only new URLs and schedule the task: the first run saves a baseline, and later runs return only URLs that are new since the previous run. This sitemap lists older GitHub Blog posts, so enter github.blog to catch new posts.

## About this Actor

This example demonstrates how to use [Sitemap Extractor & URL Finder](https://apify.com/urameshi7k/sitemap-extractor.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/urameshi7k/sitemap-extractor.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/urameshi7k/sitemap-extractor.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
