{"id":21623039,"url":"https://github.com/pandatecham/be-lib-fluent-importer","last_synced_at":"2025-07-27T00:14:10.711Z","repository":{"id":214496385,"uuid":"657475980","full_name":"PandaTechAM/be-lib-fluent-importer","owner":"PandaTechAM","description":"Library which abstract importing xlsx and csv to dotnet with fluent configuration.","archived":false,"fork":false,"pushed_at":"2025-06-01T14:29:56.000Z","size":141,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"development","last_synced_at":"2025-06-01T23:38:09.697Z","etag":null,"topics":["csv","dot-net-core","fluent","import","library","nuget","xlsx"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PandaTechAM.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-06-23T06:31:27.000Z","updated_at":"2025-06-01T14:29:15.000Z","dependencies_parsed_at":"2025-03-12T14:29:29.142Z","dependency_job_id":"b13e8126-3e13-4ac8-b1a3-b344ed1f1fc6","html_url":"https://github.com/PandaTechAM/be-lib-fluent-importer","commit_stats":null,"previous_names":["pandatecham/be-lib-file-importer","pandatecham/be-lib-fluent-importer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PandaTechAM/be-lib-fluent-importer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PandaTechAM%2Fbe-lib-fluent-importer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PandaTechAM%2Fbe-lib-fluent-importer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PandaTechAM%2Fbe-lib-fluent-importer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PandaTechAM%2Fbe-lib-fluent-importer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PandaTechAM","download_url":"https://codeload.github.com/PandaTechAM/be-lib-fluent-importer/tar.gz/refs/heads/development","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PandaTechAM%2Fbe-lib-fluent-importer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266463591,"owners_count":23932905,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csv","dot-net-core","fluent","import","library","nuget","xlsx"],"created_at":"2024-11-25T00:11:21.715Z","updated_at":"2025-07-27T00:14:10.666Z","avatar_url":"https://github.com/PandaTechAM.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pandatech FluentImporter\n\nThe `Pandatech.FluentImporter` is a lightweight NuGet package designed to facilitate the importation of CSV and Excel\ndata\ninto .NET 8 or higher applications. Featuring a fluent API, the FluentImporter enables developers to specify custom\nimport\nrules for each model property, making the data import process both straightforward and flexible.\n\n## Features\n\n- Effortlessly import CSV and XLSX (excel) data.\n- Define custom import rules using a fluent API.\n\n## Installation\n\nYou can install Pandatech FileImporter via NuGet Package Manager or .NET CLI:\n\n```bash\ndotnet add package PandaTech.FluentImporter\n```\n\n## Usage\n\n### Define Model\n\nFirst, define a model class with properties that represent the data fields you wish to import. For example:\n\n```csharp\npublic class FileData\n{\n    public long Id { get; set; }\n    public string Name { get; set; }\n    public string Description { get; set; }\n    public DateTime Date { get; set; }\n    public string? Comment { get; set; }\n    public DateTime CreatedAt { get; set; }\n    public string CreatedBy { get; set; }\n}\n```\n\n### Define Import Rules\n\nNext, create a class for import rules by inheriting from `ImportRule\u003cTModel\u003e` and define your rules using the fluent\nAPI. For example:\n\n```csharp\npublic class FileDataImportRule : ImportRule\u003cFileData\u003e\n{\n    public FileDataImportRule()\n    {\n        RuleFor(x =\u003e x.Name).NotEmpty();\n        RuleFor(x =\u003e x.Description).ReadFromColumn(\"Description text\").Default(\"No Description\");\n        RuleFor(x =\u003e x.Date).ReadFromColumn(\"Date\").Convert(DateTime.Parse);\n        RuleFor(x =\u003e x.Comment).ReadFromColumn(\"Comment\");\n        RuleFor(x =\u003e x.Id).ReadFromColumn(\"Id\").Convert(s =\u003e BaseConverter.PandaBaseConverter.Base36ToBase10(s)!.Value);\n        RuleFor(x =\u003e x.CreatedAt).WriteValue(DateTime.UtcNow);\n        RuleFor(x =\u003e x.CreatedBy).WriteValue(\"System\");\n        RuleFor(x =\u003e x.CreatedBy).ReadFromModel(x =\u003e x.CreatedBy + \" - 1\");\n    }\n}\n```\n\n### Import Data\n\nFinally, use the methods provided in your import rule instance to import data from CSV, Excel, or in-memory sources.\n\nImport from In-Memory Data\n\n```csharp\nIEnumerable\u003cTModel\u003e GetRecords(IEnumerable\u003cDictionary\u003cstring, string\u003e\u003e data)\n```\n\nImport from CSV\n\n```csharp\nList\u003cTModel\u003e ReadCsv(Stream csvStream)\nList\u003cTModel\u003e ReadCsv(string csvFilePath)\n```\n\nImport from Excel\n\n```csharp\nList\u003cTModel\u003e ReadXlsx(Stream stream)\nList\u003cTModel\u003e ReadXlsx(string csvFilePath)\n```\n\n### Example\n\n```csharp\nvar importRule = new FileDataImportRule();\nvar csvFilePath = \"path/to/your/file.csv\";\nvar importedData = importRule.ReadCsv(csvFilePath);\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit issues, feature requests, or pull requests.\n\n## License\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpandatecham%2Fbe-lib-fluent-importer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpandatecham%2Fbe-lib-fluent-importer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpandatecham%2Fbe-lib-fluent-importer/lists"}