473,320 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How create a csv file from a datatable

Is there a straightforward way of creating an excel/csv
file from a datatable. I don't know where to start with
this.

thank you.
Nov 16 '05 #1
3 11679
Hi
what you can do with one line of code it to write your table to an XML
file . Using the wirteXML command of datasets ( you can wrap your datatable
in a dataset object if it is not already contained inside one ) .
if you what to write it to excel however , you can create and adaptor that
is connected to excel file and use that adataper's update command to fill
the excel file with your datatable ( you will pass the dataset of your
table as a parameter to the update command of the adaptor)
Mohamed M .Mahfouz
Developer Support Engineer
ITWorx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #2
My CSV parser will do it for you, but it is not free unfortunately.
http://www.geocities.com/shriop/index.html
There's a WriteAll method on the CsvWriter class that takes a DataTable
and will dump the contents directly to a file or stream.

Nov 16 '05 #3
On Wed, 16 Mar 2005 02:21:07 -0800, "radiohead"
<an*******@discussions.microsoft.com> wrote:
Is there a straightforward way of creating an excel/csv
file from a datatable. I don't know where to start with
this.

thank you.


All you ever wanted to know about CSV files:
http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm

It is pretty easy to write your own class to output data in CSV to a
stream.

rossum
The ultimate truth is that there is no ultimate truth
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: David Elliott | last post by:
I can create this: ?xml version="1.0" standalone="yes" ?> <ConfigOpt> <record> <Field_1>Text # 1</Field_1> <Field_2>Text # 2</Field_2> </record> </ConfigOpt>
4
by: johnb41 | last post by:
I need to create a Dataset and datatable from an XML file. The only way I know how to make a Dataset and Datatable, is by using an Access database as my datastore: You know, the usual thing in...
5
by: Mountain Bikn' Guy | last post by:
How would I do this? public sealed class UtilityClass { public static MyObject Object1;//see note below about importance of static object names in this class public static MyObject Object2;...
12
by: Doug Bell | last post by:
Hi, I am having problems trying to create a (temporary) DataTable from a selection from a DataGrid (dgOrders). dtOrdDetails is declared as a Public DataTable Sub is: Dim stFilter as String...
1
by: mrstrong | last post by:
Gday, I have just started c# .net about 3 months ago and have recently (last week) upgraded to 2005 and hoping for some assistance understanding the best approach to adding new records to a...
13
by: JJ | last post by:
I have a need to input a large tab delimited text file, which I will parse to check it has the expected columns, before allowing the user to submit it to the database. The user may paste the file...
6
by: DAnDA | last post by:
i want to create a dll file and put below codes within public OrdersItem OrdersItem { get; set; } public List<OrdersItem> OrdersList { get; set; } public DataSet...
13
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I want to create a new column in a datatable from two existing columns. I have no problem to create the new column using the datatable.columns.add method. The problem is the value of the new...
1
by: TG | last post by:
Hi! I have an application in which I have some checkboxes and depending which ones are checked those columns will show in the datagridview from sql server or no. After that I have 2 buttons:...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.