@manhng

Welcome to my blog!

CSV Sample files

October 2, 2018 10:14

CSV Sample files (edit)

Sample CSV Files / Data Sets for Testing (till 1.5 Million Records)

http://eforexcel.com/wp/downloads-18-sample-csv-files-data-sets-for-testing-sales/

Sample CSV File for Adding Users to Office 365

https://www.microsoft.com/en-us/download/details.aspx?id=45485

using System;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace ConsoleApp1
{
    internal class Program
    {
        private static string sampleCSVFilePath = @"D:\Data\CSV\1500000 Sales Records.csv";

        private static void Main(string[] args)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            if (!File.Exists(sampleCSVFilePath))
            {
                Console.WriteLine($"File not found.");
                goto exit;
            }

            var lines = File.ReadLines(sampleCSVFilePath).Select(a => a.Split(';'));
            var CSV = (from line in lines select line[0].Split(',')).ToArray();
            stopwatch.Stop();
            Console.WriteLine("Time elapsed: {0}", stopwatch.Elapsed);

            stopwatch.Reset();

            stopwatch.Start();
            var theLines = File.ReadLines(sampleCSVFilePath).Select(a => a.Split(';'));
            var theCSV = from line in theLines select (line[0].Split(',')).ToArray();
            stopwatch.Stop();

            Console.WriteLine("Time elapsed: {0}", stopwatch.Elapsed);

        exit:
            Console.Write("Press any key to exit...");
            Console.ReadKey();
        }
    }
}

Categories

Recent posts