473,320 Members | 1,802 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.

Export Data to text/excel file

Good day,

I have a program where the report has a range before you can preview it. The user wants the record be export to .txt and excel file. Is there any idea how to construct it via code?
Jul 4 '11 #1
5 2117
It's a simple matter of building the for mat you want in a string and writing it to a file.

For excel you can use CSV (http://en.wikipedia.org/wiki/Comma-s...es#Basic_rules) format, and the text file can be simillar but columns separated by tab or use fixed length (space padded).

Only thing to be concerned is the amount of of data you need to write to the file, if it too big you might run out of memory. In that case you will have to stream or buffer the output.
Jul 4 '11 #2
Is there any sample code so that I could follow it.
Jul 4 '11 #3
Thank you for the reply. Both link that you gave to me is for csv file. Is there for txt file?
Jul 4 '11 #5
You can use the same for the text files also.
Only things is that file name should end with .txt extension and format can be any thing you like.
Jul 4 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Grey | last post by:
How to export a dataset to excel file. I need the exported data should be named with variable in excel as I need to do pivot table in the excel. So do I need to created pivot table before and only...
2
by: bienwell | last post by:
Hi all, Do you have any source code to import data from Excel file or text file into database in ASP.NET program ? Please give me your reference if you have. Thanks in advance
1
by: C | last post by:
Hi, Does anyone know of any sites that have sample code that shows how to export data to Excel using VS Tools for Office? What is the advantage of using VS Tools for Office over uisng Interop?...
1
by: huseinv | last post by:
Hi. I have a search tool which gives data in listing format and grid format (based on selection) on the same asp page. If a user select grid, the result is listed in grid format. Now how i can...
4
by: mina | last post by:
One of my client want to export data into excel file but he can not installed office just installed excel and want to export file into ..xls format at that time he got error .... Retrieving the...
1
by: madhu sudhan | last post by:
HI, I want to read data from excel file and export this data to dataset. I know abt the basics of opening a file using application, workbook and worksheet classes. But i don't know how to read...
1
by: forumaic | last post by:
Hello, I am trying to export data to excel from datagrid, and I am getting an error: "The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)." ...
1
by: arshigill | last post by:
I want to import data from excel file inot mysql database table but unable to solve this problem. I have searched google and find an example of importing of CSV excel file. But when I modify it...
0
by: JFKJr | last post by:
Hello everyone! I am trying to export Access table data into Excel file in such a way that the table field names should be in the first line of each column in excel file followed by field data, and...
5
by: sumanta123 | last post by:
Dear Sir, How to export/import the excel file in oracle database using sql promt. Please guide me the command(export/import) for the neddful. Thanks in Adavance. Regards Sumanta Panda
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.