Code Monkey home page Code Monkey logo

dataexporter's Introduction

DataExporter

Most easy way to work with *.csv, *.xlsx, *.ini files

Excel Worker

Description:

With this simple class you will be able to work with *.xlsx files as with 2-dimension array; What can be more simple than this?

Example usage:

Excel xl = new Excel();

xl.FileOpen("c:\\file1.xlsx");

var row1Cell6Value = xl.Rows[0][5];

xl.AddRow("asdf","asdffffff","5")

xl.FileSave("c:\\file2.xlsx");

Work with formulas:

var widthAdress = Excel.GetExcelPos(0, 1);
var heightAdress = Excel.GetExcelPos(0, 2);

xl.Rows[0][0] = String.Format("={0}*{1}", widthAdress , heightAdress);

Why I had chose exactly this way to interact with xlsx files?

This info can be useful in case of you need sth MORE than my class functionality. There is exist few ways to interact with Excel files. Let's check my short experience with them:

  • Microsoft.Office.Interop.Excel

    • Excel must be installed on the machine
    • Extremally slow (11 250 cells will be saved in 22 sec)
    • Lot of memory leaks
    • Hard to write code. In case of some code mistakes you will leave background runned Excel process.
  • OleDB

    • No ability to work with formulas (you will be able only to read value from cell, but not a formula)
    • Fast
    • Easy in use
  • OpenXml

    • Hard in use/ Code is not easy readeble
    • Fast
  • ClosedXml ( wrapper around OpenXml ) [used in my lib]

    • Easy in use
    • Fast. In 57 times faster than Interop (20 000 cells will be saved in 00:00:00.6787608 sec)

Csv Worker

Description:

With this simple class you will be able to work with csv, tsv and other *sv files as with 2-dimension array; What can be more simple than this?

This class uses standard Microsoft.VisualBasic.FileIO VS library. This library have 2 weak point's that you need to know:

  • It's works only in standard VS projects (as example you cannot use it in Unity project)
  • It doesnt work with large files (I have lame hack for this -- separate csv to few files). But most of users will not see such behavior :)

Example usage:

Csv csv = new Csv();

csv.FileOpen("c:\\file1.csv");

var row1Cell6Value = csv.Rows[0][5];

csv.AddRow("asdf","asdffffff","5")

csv.FileSave("c:\\file2.csv");

Work with tsv files (exaple of usage another separator):

Csv csv = new Csv('\t');

Ini Worker

Description:

Simple class to work with ini files. Ini files data saved with the following dara: "Section", "key" and "value".

It's slow because of it's based on 'kernel32.dll' methods. If you need to read/write lot of data better to use some another library. But in another case its a good way.

Example usage:

Ini ini = new Ini(filePath);

ini.Write("SomeKey", "SomeValue");// Will be saved to "Default" section
ini.Write("SomeSection", "SomeKey", "SomeValue");

var a = ini.Read("SomeKey"); // will read SomeKey value from "Default" section
var b = ini.Read("SomeSection", "SomeKey", "SomeValue");

dataexporter's People

Contributors

ukushu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.