Skip to content

Commit 3e2a972

Browse files
author
Marcin kotynia
committed
excel..
1 parent 51ce85b commit 3e2a972

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

SRC/Program.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ static void Main(string[] args)
4949
{
5050
// for test only
5151
// args = new string[] { "--help" };
52-
// args = new string[] { "-s", "\\t", "-t", "template.txt", "-i", "test.xls", "-l", "5" };
53-
//args = new string[] { "-t", "template.txt", "-i", "Book1.xlsx" };
52+
// args = new string[] { "-s", "\\t", "-t", "template.txt", "-i", "test.csv", "-l", "5" };
53+
// args = new string[] { "-t", "template.txt", "-i", "Book1.xlsx" };
5454

5555
try
5656
{
@@ -78,17 +78,17 @@ static void Main(string[] args)
7878
Console.WriteLine("-t {0,-20} {1}", "template", options.TemplateFile);
7979
Console.WriteLine("-i {0,-20} {1}" , "csv file or xlsx file",options.InputFile);
8080
Console.WriteLine("-o {0,-20} {1}", "oputput file", options.OutputFile);
81-
Console.WriteLine("-s {0,-20} {1}", "separator", options.FieldSeparator);
81+
Console.WriteLine("-s {0,-20} {1}", "separator", options.FieldSeparator); // only for csv
8282
Console.WriteLine("-l {0,-20} {1}", "start from Line", options.startFromLine);
8383
Console.WriteLine("loading template...");
84-
string template = System.IO.File.ReadAllText(options.TemplateFile); // example Insert into table (column1, column2) values({0}, {1})"
84+
string template = System.IO.File.ReadAllText(options.TemplateFile); // example Insert into table (column1, column2) values({0}, {1})"
8585
Console.WriteLine(template);
8686

8787

8888
int i = 0;
8989
StringBuilder sb = new StringBuilder();
9090

91-
if ( options.InputFile.EndsWith("xlsx")) //EXCEL
91+
if ( options.InputFile.EndsWith("xlsx")) //EXCEL XLSX PROCESOR
9292
{
9393
var package = new ExcelPackage(new FileInfo(options.InputFile));
9494

@@ -106,9 +106,7 @@ static void Main(string[] args)
106106
List<string> rowx = new List<string>();
107107
for (int col = start.Column; col <= end.Column; col++)
108108
{
109-
rowx.Add(workSheet.Cells[row, col].Text); // This got me the actual value I needed.
110-
111-
109+
rowx.Add(workSheet.Cells[row, col].Text); // Value not value:)
112110
}
113111
Console.Write("\r{0} of {1}", i, end.Row);
114112
sb.AppendLine(string.Format(template, rowx.ToArray()));
@@ -117,7 +115,7 @@ static void Main(string[] args)
117115
}
118116

119117
}
120-
else //CSV processing
118+
else //CSV PROCESOR
121119
{
122120
using (StreamReader r = new StreamReader(options.InputFile))
123121
{

0 commit comments

Comments
 (0)