---
title: "List all available spaces"
canonical: "https://support.appfire.com/space/REPS/475513646/List%20all%20available%20spaces"
format: markdown
---
> Macro (aura-html)

## Scenario

This recipe displays a list of all available spaces in the Confluence instance and sorts them alphabetically.

## Result

![image](media://03251930-2f1b-433f-9fe6-613511a9ce56)

## Recipe

| Apps | Reporting for Confluence Data Center |
| --- | --- |
| Level | Intermediate |
| Estimated time | 5 minutes |
| Macros | Report Block, Report Body, Report Info, Space Reporter, Text Sort |
| Suppliers | Space Supplier |

## Storage format

You can copy and paste this code into the [Confluence Source Editor](https://appfire.atlassian.net/wiki/spaces/REPS/pages/472907841):

```
<p class="auto-cursor-target">
  <br />
</p>
<ac:structured-macro ac:macro-id="184ba119-e470-4247-905c-4b33096f15a8" ac:name="report-block" ac:schema-version="1">
  <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
  <ac:rich-text-body>
    <p class="auto-cursor-target">
      <br />
    </p>
    <ac:structured-macro ac:macro-id="30b59f60-ff5f-4269-8411-45909b09d58e" ac:name="space-reporter" ac:schema-version="1">
      <ac:rich-text-body>
        <ac:structured-macro ac:macro-id="27909439-e015-4f98-9caa-a7d81cfbe71c" ac:name="text-sort" ac:schema-version="1">
          <ac:parameter ac:name="">space:name</ac:parameter>
        </ac:structured-macro>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p class="auto-cursor-target">
      <br />
    </p>
    <ac:structured-macro ac:macro-id="0c6bdebd-1a2a-415c-bd2e-8dec740c545d" ac:name="report-body" ac:schema-version="1">
      <ac:rich-text-body>
        <p>
          <ac:structured-macro ac:macro-id="1cffc561-7dcf-455a-8582-72a3b6cc82dc" ac:name="report-info" ac:schema-version="1">
            <ac:parameter ac:name="link">true</ac:parameter>
            <ac:parameter ac:name="">space:name</ac:parameter>
          </ac:structured-macro> (<ac:structured-macro ac:macro-id="611f1f81-d75d-4d33-94fd-d9fac595e4f3" ac:name="report-info" ac:schema-version="1">
            <ac:parameter ac:name="">space:key</ac:parameter>
          </ac:structured-macro>)</p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p class="auto-cursor-target">
      <br />
    </p>
  </ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
  <br />
</p>
```


## Macro structure

You can recreate the example in the editor view:

![image](media://1d4cfcd5-b389-44ef-944a-628f6344f71d)



## Line-by-line explanation

| **Line** | **Description** |
| --- | --- |
| 1 | The Report Block macro formats the report as a table. |
| 2 | The Space Reporter macro retrieves all spaces within the Confluence instance. |
| 3 | The Text Sort macro, with **Key**: `space:name`, sorts the table by space name. |
| 4 | The Report Body macro serves as a container for displayed contents. |
| 5 | The Report Info macro, with **Key**: `space:name `and **Link To Item**: selected, displays a link to the individual space. |
| 6 | The Report Info macro, with **Key**: `space:key`, displays the corresponding space key. |