---
title: "How to Display an Attached CSV File as a Confluence Table"
canonical: "https://support.appfire.com/space/SUPPORT/89138989/How%20to%20Display%20an%20Attached%20CSV%20File%20as%20a%20Confluence%20Table"
format: markdown
---
> Macro (div)
> 
> ### On this page
> 
> > Macro (toc)

> Macro (include)

# Recipe overview

This recipe provides step-by-step instructions on how to display an attached CSV file as a table on a Confluence page. Because this recipe is using a very large (3,000 record) CSV file, it will leverage the [Cache for Confluence add-on](https://marketplace.atlassian.com/plugins/org.swift.confluence.cache) to ensure the rendering of the page occurs as quickly as possible. This add-on features these macros:

- The **Cache**** macro**, which allows a page to be saved in a cache after being rendered so that subsequent users viewing the page benefit from a much faster page rendering. The Cache macro "wraps around" the page content to be cached, and its parameters allow you to control the length of time the data is cached or optionally allow the user to manually refresh the cache.
- The **Future macro**, which allows the page to be rendered as it becomes available. This allows the user to see quickly rendered content immediately, while the output of longer running macros is being rendered in the background. This macro also "wraps around" the content it controls. The list of macros that work with the Future macro, including the Cache macro, is listed [here](https://appfire.atlassian.net/wiki/spaces/CACHE/pages/66585164).

Please read [Page display performance tips and techniques](https://appfire.atlassian.net/wiki/spaces/CACHE/pages/66590270) to learn more about what can affect the performance of a Confluence page.

:info: It will take you approximately 4 minutes to complete this recipe.

# Recipe level

> Macro (table-plus)
> 
> |  |
> | --- |
> | ![image](media://f492a81a-1136-4db5-a6ce-af0224a505f6) |

# Ingredients

> Macro (table-plus)
> 
> |  |  |
> | --- | --- |
> | ![image](media://97467fd5-385c-452b-9fa6-1334a56136b5) | [Confluence](https://bobswift.atlassian.net/wiki/spaces/recipes/pages/103613154/Confluence+Recipes) |
> | ![image](media://9ac0f70b-87eb-4736-a1f8-f0bc60468903) | [Advanced Tables for Confluence](https://bobswift.atlassian.net/wiki/spaces/recipes/pages/104399024/Advanced+Tables+for+Confluence+Recipes)<br>> Macro (legacy-content)<br>> Macro (legacy-content) |
> | ![image](media://a32fb6f5-131a-4a9a-bd42-3c4a8261780d) | [Cache for Confluence](https://bobswift.atlassian.net/wiki/spaces/recipes/pages/106660166/Cache+for+Confluence+Recipes)<br>> Macro (legacy-content)<br>> Macro (legacy-content) |

# Preparation

- Download the attached [SalesLeads.csv file](https://appfire.atlassian.net/wiki/spaces/SUPPORT/pages/89138989) to your computer. The file contains contact information for 3,000 potential sales leads. It was randomly generated using an online tool called [Mockaroo](https://www.mockaroo.com/) so it does not reflect real people or companies. Here is an excerpt from that file, with the first row identifying each field.

# Steps

> Macro (table-plus)
> 
> |  |  |  |
> | --- | --- | --- |
> | ![image](media://3c39dbc7-b6c3-452d-a5b4-0ee58ed73c46) | ## Create Confluence page and add the CSV macro<br>> Macro (legacy-content)<br>Create a Confluence page that will display the **SalesLeads.csv** file in a table so that others can easily review it.<br>1. Type in an introductory paragraph that describes the purpose of the page or anything else the viewer ought to know.
> 2. Click the
>   toolbar button (or choose **Ctrl-M** for Windows or **Command-M** for Mac) so that you can attach the **SalesLeads.csv** file to this page.
>   1. On the **Attached to this page** tab, click **Upload files**.
>   2. Navigate to the location to which you downloaded the SalesLeads.csv file, select  the file and click **Open** to complete the upload.
>   3. Click **Cancel** since you don't want to insert the file. (You'll be using the CSV macro to display it instead.)
> 3. With the cursor positioned after your introductory paragraph, insert the **CSV macro**, which is part of the [Advanced Tables for Confluence add-on](https://marketplace.atlassian.com/plugins/org.swift.confluence.table).
>   1. Click on the CSV macro container and configure with the parameters shown on the right.
>   2. Click **Save** to save your changes to the CSV macro parameters.
>   3. The page should look like the first screenshot shown to the right.
> 4. Click **Save** the page.<br>You should see the page in the second screenshot shown to the right, after a few seconds delay.<br>> ℹ️ **Other Ways to Supply the CSV File**
> > ℹ️ 
> > ℹ️ You can also reference a CSV file that is stored on an external server or web site, by using the CSV macro's URL parameter.
> > ℹ️ 
> > ℹ️ You can also leverage the power of the [Run CLI Actions in Confluence](https://marketplace.atlassian.com/plugins/org.swift.confluence.acli) add-on and other [Command Line Interface (CLI) add-ons](https://marketplace.atlassian.com/search?q=command+line+interface) to have your CSV file created and attached to the desired Confluence page automatically or on a scheduled basis. The [How to Monitor Language in Public Chat Rooms (Advanced)](https://appfire.atlassian.net/wiki/spaces/SUPPORT/pages/89140320) recipe provides an example of this. | > Macro (anchor)
> 
> **CSV Macro parameters:**<br>> Macro (nested-table)<br>**Sales Leads page, in Edit mode:**<br>![image](media://96a2d329-cbe3-4686-b404-a10b87d81dc3)<br>**Sales Leads page, in View mode:**<br>![image](media://315e7160-5f65-4c14-b634-f4ec98b8b088) |
> | --- |
> | ![image](media://ea6e2e38-659c-44ff-a207-b88c62344e54) | ## Tune performance by adding the Cache macro<br>> Macro (legacy-content)<br>If this Sales Lead page is used heavily, any performance penalty associated with showing such a large amount of data can be costly since it is incurred by each visit to the page. Therefore, you're now going to add the Cache macro of the [Advanced Tables for Confluence add-on](https://marketplace.atlassian.com/plugins/org.swift.confluence.table) to speed up the page rendering and reduce the page's use of system resources.<br>Edit the **Sales Leads** page, and do the following:<br>1. With the cursor positioned at the end of the introductory paragraph, press **Enter** a few times to add some blank lines above the CSV macro.
> 2. Move to the second blank line and insert the **Cache** macro.
>   1. Click on the Cache macro container and adjust its parameters as shown to the right.
>   2. Click **Save** to save your changes to the Cache macro parameters.
> 3. Click on the CSV macro container and drag it into the Cache macro container.
> 4. Your screen should look like the first screenshot shown to the right.
> 5. Click **Save** to save the page.
> 6. It should now look like the second screenshot shown to the right and should render more quickly. More importantly, each subsequent user should see the page render nearly instantaneously as it will be be loaded from the cache until its reaches the end of its 2-day refresh period.
> 7. The Cache macro is displaying the Refresh icon along with the date the cache was last refreshed. A user can click the refresh icon to force the cache to be immediately refreshed. | > Macro (anchor)
> 
> **Cache Macro parameters:**<br>> Macro (nested-table)<br>**Sales Leads page, in Edit mode:**<br>![image](media://991ab41b-e578-4df3-a65d-28fae937b265)<br>**Sales Lead page, in View mode:**<br>![image](media://24bf1b01-7393-4bbf-9b3e-530238377c76) |
> | --- |
> | ![image](media://1fd522c3-c3be-4ce0-9b36-b97d7fb3b2fe) | ## Bonus Tip<br>> Macro (legacy-content)<br>If you have a very complex page or one that is using many macros, you may find the use of the Cache macro helps considerably but the user still has to wait a while to see the full page rendered. This is where the **Future macro** can help.<br>As explained [here](https://appfire.atlassian.net/wiki/spaces/CACHE/pages/66585164), the Cache macro can be enclosed within the Future macro to allow some of the page rendering to occur while the rest of the page is rendered in the background. The user will then see content as soon as it is available, making the page's full rendering time less noticeable.<br>To continue with our example above, edit the **Sales Leads** page and do the following:<br>1. With the cursor positioned above the Cache macro container, press **Enter** to add another blank line above the Cache macro container.
> 2. Move to that new blank line and insert the **Future** macro.
>   1. Click on the Future macro container and adjust its parameters as shown to the right.
>   2. Click **Save** to save your changes to the Future macro parameters.
> 3. Click on the Cache macro container and drag it into the Future macro container.
> 4. Your screen should look like the first screenshot shown to the right.
> 5. Click **Save** to save the page.
> 6. When the page is in the process of being rendered, you will see the "Loading" message shown in the second screenshot to the right. This is the Future macro doing its job. 😉
> 7. When the rendering is complete, you will see the Refresh icon and the date on which the cache was last refreshed… courtesy of the Cache macro.<br>> ℹ️ If your Confluence instance is using the [Macro Security for Confluence](https://marketplace.atlassian.com/plugins/org.swift.confluence.macrosecurity) add-on and your Confluence Administrator has restricted use of a [macro security managed macro](https://appfire.atlassian.net/wiki/spaces/CMSP/pages/67404857) such as Future or Cache, you may see an error after saving the page.
> > ℹ️ 
> > ℹ️ If this is the case, you will need to add a [page-level Edit restriction](https://confluence.atlassian.com/display/DOC/Page+Restrictions) that conforms to the restriction implemented in the Macro Security configuration. More information is available in the [Macro Security User's Guide](https://appfire.atlassian.net/wiki/spaces/CMSP/pages/67404950). | > Macro (anchor)
> 
> **Future macro parameters:**<br>> Macro (nested-table)<br>**Sales Lead page, in Edit mode:**  
> > Macro (inline-media-image)<br>**Excerpt of Sales Lead page, while the page is being rendered:**<br>![image](media://35ac4985-b188-4481-9627-3909a7b84be2)<br>**Sales Lead page, after page is fully** **rendered:**> Macro (inline-media-image) |

> Macro (include)