Home

Bytescout.XLS for .NET
Screenshots

Click to view sample
Click to view sample
Click to view sample
Click to view sample
Click to view sample
Click to view sample
Click to view sample Click to view sample

Bytescout.XLS library for .NET

Download Free Trial Buy Now More Information

How to convert Excel document into CSV (comma separated data) file using Bytescout.XLS library

This source code sample shows how to convert excel XLS document into comma-separated data file (.CSV) using Bytescout.XLS library with C# in .NET

Download example source code: bytescoutxls_converting_excel_to_csv.zip (8 KB)

Source Excel document

CSV generated from Excel document using Bytescout.XLS library

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Bytescout.XLS;

namespace Converting_XLS_to_TXT
{
class Program
{
static void Main(string[] args)
{
// Create new XLSDocument from SimpleReport.xls file
XLSDocument document = new XLSDocument("SimpleReport.xls");
// Create new StringBuilder
StringBuilder builder = new StringBuilder();
// For each row
for (int row = 1; row <= document.WorkBook.Worksheets[0].LastRow; row++)
{
// And column in first Worksheet
for (int col = 1; col <= document.WorkBook.Worksheets[0].LastColumn; col++)
{
// Append cell value to StringBuilder
builder.AppendFormat("{0}\t", document.WorkBook.Worksheets[0].Cell(row, col).Value);
}
// Append new line
builder.AppendLine();
}
// Save StringBuilder to file
File.WriteAllText("SimpleReport.txt", builder.ToString());
}
}
}

Download example source code: bytescoutxls_converting_excel_to_csv.zip (8 KB)

Download Free Trial Buy Now More Information

Documentation online: view (separate window)

First steps tutorials:

Advanced Examples:
Products  |  Download  |  Purchase  |  Support  |  Contacts  |  Testimonials  |  News |  

ByteScout, 2003-2008. All other company and product names may be trademarks of their respective companies. Privacy Statement