Creating a bar chart from datatable I'm writing a console application that fetches data from database (SQL) and writes to an excel sheet. Now I want to add a chart in the workbook according to the datatable values. How can I create chart in the sheet before saving? How will I use dataset values to create chart?

Thank you.
If you are using csv , you can not do this. But if you are willing to use other tools like Microsoft SQL Server Reporting Services or Crystal Reports you may do this.


SSRS Chart Example, here another one with code example.


If you can not install Reporting Services Server or do not want to, you can still use it for basic reporting purposes. Take a look at here,Microsoft Reporting without SQL Server Reporting Services.

Note that , I gave you examples for reporting services since it is easy to use out of box and in most cases free. But there are a lot of other tools exists which may be more suitable/powerful for your use case.