- [Home page](https://www.brimit.com/)
- [Blog](https://www.brimit.com/blog)

# Sitecore Commerce 9: How to Export a CSV File from a Pipeline Block

[#How-to](https://www.brimit.com/blog?categories=#How-to) [DXP](https://www.brimit.com/blog?platforms=DXP)
[Andrei Paliakou](https://www.brimit.com/blog/author?authors=Andrei%20Paliakou) on December 9, 2020

![sitecore-techtalks](https://www.brimit.com/-/jssmedia/project/brimit/blog/2020/sitecore-techtalks.png?h=476&iar=0&w=716&hash=0BE2628F3BA744B18C11741903BB4DC2)

Few days ago, I saw a question on Sitecore #commerce Slack channel. The question is:

*Any idea on how we can forcefully download a csv file from a pipeline block?*In my previous blog post, I explained how to export Price Books. In case of Price Books, there was exported data in
zip extension. Therefore, it is not a big deal to implement the export of any custom data from Sitecore Commerce in csv
format. I have implemented a sample plugin and in the current blog post will share my knowledge how I did it.

The source code you can find here: [https://github.com/Frog911/Plugin.Sample.Commerce.ExportCsv](https://github.com/Frog911/Plugin.Sample.Commerce.ExportCsv)

First of all, you have to add reference to CsvHelper NuGet package.

Then we have to create *IExportDataPipeline* pipeline:

[![Sitecore Commerce 9: Export csv](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-7/1.png?w=900&hash=F3E0526244193F186D2710239119691F)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-7/1.png)

[![Sitecore Commerce 9: Export csv](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-7/2.png?w=900&hash=5396E063612F5558349EEC4578E16D62)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-7/2.png)

For this pipeline, we have to create *ExportDataBlock*:

[![Sitecore Commerce 9: Export csv](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-7/3.png?w=900&hash=5AA1719C9C5400E0D4FBC598147950D3)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-7/3.png)

Here we are using *IStreamDataToCsvPipeline,* which we also have to implement.

[![Sitecore Commerce 9: Export csv](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-7/4.png?w=900&hash=FFA7AE0DC2E753898089E61A83E4CA4D)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-7/4.png)

[![Sitecore Commerce 9: Export csv](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-7/5.png?w=900&hash=5C82C2BDCE958E93CB6EAE30A1F065E2)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-7/5.png)

*IStreamDataToCsvPipeline* will contain *StreamDataToCsvBlock,* which will be responsible to build csv
    file for download.

[![Sitecore Commerce 9: Export csv](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-7/6.png?w=900&hash=27981DA2C7085A693353F88D11A70553)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-7/6.png)

And, of course, we have to register our pipelines.

[![Sitecore Commerce 9: Export csv](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-7/7.png?w=900&hash=CB413EADE78FBACD69EE928A5305ADBB)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-7/7.png)

How we are ready to use these pipelines in any custom endpoint and we can use Postman to test these logic.

[![Sitecore Commerce 9: Export csv](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-7/8.png?w=900&hash=215E5E27F9AB239D89BE0222C8E3581A)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-7/8.png)

I hope this blog post will be useful for someone who wants to implement such export data feature.

Stay tuned!

###### Author

![apaliakou](https://www.brimit.com/-/jssmedia/feature/blogs/authors/apaliakou.jpg?h=216&iar=0&w=360&hash=5BE96F17AE5B47F66D9F684B87773675)

Andrei Paliakou

Sitecore MVP/ Lead Developer
[Andrei Paliakou](https://www.brimit.com/blog/author?authors=Andrei%20Paliakou)

###### More By Categories

[#Events](https://www.brimit.com/blog?categories=#Events) [#How-to](https://www.brimit.com/blog?categories=#How-to) [#News](https://www.brimit.com/blog?categories=#News) [#Guides](https://www.brimit.com/blog?categories=#Guides)

###### More by Platform

[Data and AI](https://www.brimit.com/blog?platforms=Data%20and%20AI) [DXP](https://www.brimit.com/blog?platforms=DXP) [E-commerce](https://www.brimit.com/blog?platforms=E-commerce) [Internet of Things](https://www.brimit.com/blog?platforms=Internet%20of%20Things) [Sales and marketing automation](https://www.brimit.com/blog?platforms=Sales%20and%20marketing%20automation)
