Giter Site home page Giter Site logo

How to create excel file? about etl.net HOT 4 OPEN

ssccinng avatar ssccinng commented on May 10, 2024
How to create excel file?

from etl.net.

Comments (4)

paillave avatar paillave commented on May 10, 2024

I will come back to you asap. Can you give me an example of your code?

from etl.net.

ssccinng avatar ssccinng commented on May 10, 2024

I will come back to you asap. Can you give me an example of your code?

I know how to use it. Can I add some test cases to this project?

It took me some time to find out how to use them

using System;
using System.Threading.Tasks;
using Paillave.Etl.Core;

namespace SimpleTutorial
{
    class Program
    {
        static async Task Main(string[] args)
        {
            var processRunner = StreamProcessRunner.Create<string>(DefineProcess);
            var res = await processRunner.ExecuteAsync("InputFiles");
            Console.Write(res.Failed ? "Failed" : "Succeeded");
        }
        private static void DefineProcess(ISingleStream<string> contextStream)
        {

            contextStream.CrossApplyFolderFiles("get data", "*.csv")
                .CrossApplyTextFile("Parse data", FlatFileDefinition.Create(i => new
                {
                    a = i.ToColumn("a")
                }).IsColumnSeparated(','))
                ////.CrossApplyExcelSheets("dani")
                //.CrossApplyExcelRows("get rows", o => new  { a = "!"})
                .ToExcelFile("to excel", "ex.xlsx", ExcelFileDefinition.Create(i => new
                {
                    a = i.ToColumn("b")
                }).HasColumnHeader("A1:C1")
                .WithDataset("A2:C2"))
                .WriteToFile("write", i => i.Name);
            // TODO: Define the ETL process here
        }
    }
}

from etl.net.

paillave avatar paillave commented on May 10, 2024

Sorry for this, I tried to find some time yesterday to provide an example. As I mentioned on the cast, documentation is an ongoing project and I'm glad questions are posted here to mitigate this (temporary) lack.
Bty, I will make some changes to provide a more straightforward way to read/write excels (with HasColumnHeader and WithDataset being optional)

from etl.net.

paillave avatar paillave commented on May 10, 2024

Can I add some test cases to this project?

Every pull request is more than welcome!
There was a time when I had bunch of them, but I put them apart since the new version. This is also a work to be done.

from etl.net.

Related Issues (20)

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.