Purcell 2.0.4

dotnet add package Purcell --version 2.0.4
                    
NuGet\Install-Package Purcell -Version 2.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Purcell" Version="2.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Purcell" Version="2.0.4" />
                    
Directory.Packages.props
<PackageReference Include="Purcell" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Purcell --version 2.0.4
                    
#r "nuget: Purcell, 2.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Purcell&version=2.0.4
                    
Install Purcell as a Cake Addin
#tool nuget:?package=Purcell&version=2.0.4
                    
Install Purcell as a Cake Tool

Purcell

一个超高性能的强类型读写表格文件的ORM库,支持 .xls.xlsx.xlsb.csv 格式,专为 .NET 设计,极致性能与易用性兼备。

特性

  • 🚀 极致性能:大批量数据导入导出毫无压力
  • 🏷️ 强类型映射:支持对象与表格字段自动映射
  • 📦 多格式支持:兼容 .xls.xlsx.xlsb.csv
  • 🧩 灵活扩展:支持自定义导入导出、字段映射、样式等
  • 🧪 完善测试:单元测试与基准测试齐全
  • 🛠️ 异步/同步 API:满足不同场景需求

安装

通过 NuGet 安装:

dotnet add package Purcell

Purcell 采用四段式版本号 (W.X.Y.Z),遵循以下规则:

  • W:主版本号,表示重大架构变更或不兼容API调整
  • X:次版本号,表示功能新增,向下兼容
  • Y:修订版本号,表示bug修复和小改进
  • Z:构建版本号,表示构建标识

指定特定版本安装:

dotnet add package Purcell --version 1.2.3.4

快速上手

读取 Excel 到对象列表

using PurcellLibs;

// 假设有一个 Person 类
public class Person
{
    public string Name { get; set; }
    public int Age { get; set; }
}

// 读取 .xlsx 文件
var people = Purcell.Query<Person>("data.xlsx").ToList();

导出对象列表到 Excel

using PurcellLibs;

var people = new List<Person>
{
    new Person { Name = "张三", Age = 18 },
    new Person { Name = "李四", Age = 20 }
};

Purcell.Export(people, "output.xlsx");

支持异步操作

await foreach (var person in Purcell.QueryAsAsync<Person>("data.xlsx"))
{
    Console.WriteLine(person.Name);
}

API 概览

  • Purcell.Query<T>(...):读取 Excel/CSV 到强类型对象集合
  • Purcell.Export<T>(...):导出对象集合到 Excel/CSV
  • 支持流式、文件路径、同步/异步多种方式
  • 支持自定义字段映射、表头、样式、密码保护等高级功能

详细 API 参考 Wiki 或源码注释。

生态与扩展

贡献

欢迎 Issue、PR 和建议!请阅读 CONTRIBUTING.md 了解贡献流程。

许可证

MIT License © LileyZhao


如需更详细的用法、进阶特性或遇到问题,欢迎访问 项目主页 或提交 Issue。

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.4 165 4/21/2025
2.0.3 138 4/21/2025
2.0.2 142 4/21/2025
2.0.1 154 4/18/2025
2.0.0.1 152 4/18/2025
2.0.0 180 4/16/2025
1.0.5 894 8/19/2023
1.0.4 188 8/19/2023
1.0.3 186 8/19/2023
1.0.2 277 3/1/2023
1.0.1 200 3/1/2023