Reputation: 165
New at C# using visual studio 2010 and trying to get output in a text file from an excel sheet. The excel sheet contains only one column with numeric values like this:
ColumnA
-------
222
333
444
555
666
777
888
999
877
566
767
678
767
I am trying to get the output in the text file like this:
222, 333, 444,
555, 666, 777,
888, 999, 877,
566, 767, 678,
767
Thanks in advance.
Upvotes: 3
Views: 3468
Reputation: 36423
This should do it using the BytesCout SpreadSheet SDK:
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Bytescout.Spreadsheet;
namespace Converting_XLS_to_TXT
{
class Program
{
static void Main(string[] args)
{
// Create new Spreadsheet from SimpleReport.xls file
Spreadsheet document = new Spreadsheet("SimpleReport.xls");
// delete output file if exists already
if (File.Exists("SimpleReport.txt")){
File.Delete("SimpleReport.txt");
}
// save into TXT
document.Workbook.Worksheets[0].SaveAsTXT("SimpleReport.txt");
}
}
}
References:
Upvotes: 1