godsharp - Hsu.Db.Export.Spreadsheet.Hosting 2023.307.24
A database table export spreadsheet component hosting, which can export Excel and Csv files, and supports Excel templates for Windows and Linux.
PM> Install-Package Hsu.Db.Export.Spreadsheet.Hosting -Version 2023.307.24 -Source https://www.myget.org/F/godsharp/api/v3/index.json
> nuget.exe install Hsu.Db.Export.Spreadsheet.Hosting -Version 2023.307.24 -Source https://www.myget.org/F/godsharp/api/v3/index.json
> dotnet add package Hsu.Db.Export.Spreadsheet.Hosting --version 2023.307.24 --source https://www.myget.org/F/godsharp/api/v3/index.json
<PackageReference Include="Hsu.Db.Export.Spreadsheet.Hosting" Version="2023.307.24" />
Copy to clipboard
source https://www.myget.org/F/godsharp/api/v3/index.json
nuget Hsu.Db.Export.Spreadsheet.Hosting ~> 2023.307.24
Copy to clipboard
> choco install Hsu.Db.Export.Spreadsheet.Hosting --version 2023.307.24 --source https://www.myget.org/F/godsharp/api/v2
Import-Module PowerShellGet
Register-PSRepository -Name "godsharp" -SourceLocation "https://www.myget.org/F/godsharp/api/v2"
Install-Module -Name "Hsu.Db.Export.Spreadsheet.Hosting" -RequiredVersion "2023.307.24" -Repository "godsharp"
Copy to clipboard
Hsu.Db.Export.Spreadsheet
A component that regularly exports database tables to spreadsheets every day, can export Excel and Csv files, and supports Excel templates.
Package Version
- Hsu.Db.Export.Spreadsheet : library
- Hsu.Db.Export.Spreadsheet.Hosting : template
| Name | Source | Stable | Preview |
|---|---|---|---|
| Hsu.Db.Export.Spreadsheet | Nuget | ||
| Hsu.Db.Export.Spreadsheet | MyGet | ||
| Hsu.Db.Export.Spreadsheet.Hosting | Nuget | ||
| Hsu.Db.Export.Spreadsheet.Hosting | MyGet |
Getting Started
Install Packages
- Hsu.Db.Export.Spreadsheet
- FreeSql
Configure DependencyInjection
static void ConfigureServices(IServiceCollection services, IConfiguration configuration)
{
services.AddDailySyncSpreadsheet();
ConfigureFreeSql(services, configuration);
}
static void ConfigureFreeSql(IServiceCollection services, IConfiguration configuration)
{
var freeSql = new FreeSqlBuilder()
.UseConnectionString(DataType.MySql, configuration.GetConnectionString("Default"))
.Build();
freeSql.Aop.CommandAfter += (_, e) =>
{
if (e.Exception != null)
{
Log.Logger.Error("Message:{Message}\r\nStackTrace:{StackTrace}", e.Exception.Message, e.Exception.StackTrace);
}
Log.Logger.Debug("FreeSql>A>{Sql}", e.Command.CommandText);
};
freeSql.Aop.CommandBefore += (_, e) =>
{
Log.Logger.Debug("FreeSql>B>{Sql}", e.Command.CommandText);
};
services.AddSingleton(freeSql);
}
Add Export Options
- Update ConnectionString
- Update Export Options
Templateonly supportExcelexport
{
"ConnectionStrings": {
"Default": "Data Source=mysql.sqlpub.com;Port=3306;User ID=public;Initial Catalog=db_hsu_des;Charset=utf8;SslMode=none;Min pool size=1"
},
"Export": {
"Spreadsheet": {
"Trigger": "00:00:00",
"Launch": true,
"Interval": "00:00:30",
"Timeout": "00:01:30",
"Path": null,
"Tables": [
{
"Name": "Employees",
"Code": "employees",
"Filter": "create_at",
"Chunk": 5000,
"AscOrder": true,
"Output": "Csv",
"Fields": [
{
"Name": "EmployeeNo",
"Column": "emp_no",
"Type": "Int32"
},
{
"Name": "Birthdate",
"Column": "birth_date",
"Type": "DateTime",
"Format": "yyyy-MM-dd"
},
{
"Name": "First Name",
"Column": "first_name",
"Type": "String"
},
{
"Name": "Last Name",
"Column": "last_name",
"Type": "String"
},
{
"Name": "Gender",
"Column": "gender",
"Type": "String",
"Format": "yyyy-MM-dd"
},
{
"Name": "Hire Date",
"Column": "hire_date",
"Type": "DateTime",
"Format": "yyyy-MM-dd"
},
{
"Name": "Create At",
"Column": "create_at",
"Type": "DateTime"
}
]
},
{
"Name": "Titles",
"Code": "titles",
"Filter": "create_at",
"Chunk": 5000,
"AscOrder": true,
"Output": "Xlsx",
"Fields": [
{
"Name": "EmployeeNo",
"Column": "emp_no",
"Type": "Int32"
},
{
"Name": "Title",
"Column": "title",
"Type": "String"
},
{
"Name": "From Date",
"Column": "from_date",
"Type": "DateTime",
"Format": "yyyy-MM-dd"
},
{
"Name": "To Date",
"Column": "to_date",
"Type": "DateTime",
"Format": "yyyy-MM-dd"
},
{
"Name": "Create At",
"Column": "create_at",
"Type": "DateTime"
}
]
},
{
"Name": "Salaries",
"Code": "salaries",
"Filter": "create_at",
"Chunk": 5000,
"AscOrder": false,
"Template": "ExportTemplate.xlsx",
"Output": "Xlsx",
"Fields": [
{
"Name": "EmployeeNo",
"Column": "emp_no",
"Property": "EmployeeNo",
"Type": "Int32"
},
{
"Name": "Salary",
"Column": "salary",
"Property": "Salary",
"Type": "Int32",
"Format": "0000.00"
},
{
"Name": "From Date",
"Column": "from_date",
"Property": "FromDate",
"Type": "DateTime",
"Format": "yyyy-MM-dd"
},
{
"Name": "To Date",
"Column": "to_date",
"Property": "ToDate",
"Type": "DateTime",
"Format": "yyyy-MM-dd"
},
{
"Name": "Create At",
"Column": "create_at",
"Type": "DateTime"
}
]
}
]
}
}
}
- Worker
- Trigger : The time to sync tables to local
- Launch : if true will execute once at startup
- Interval : The time to wait for export mutil days
- Timeout : The time to wait for table read operations
- Path : The path that export file storage
- Tables
- Name : The name of the column, to display in header
- Code : The column of the table
- Filter : The date column to filter
- Chunk : The size of the chunk per read from the database
- AscOrder : Is ascending or descending
- Output : Only
CsvandXlsx
- Fields
- Property : The name of the property for object to export,if null use
Column- Type : The type of field, default is
String- Nullable : The field is nullable
- Template : The template excel file,only
Xlsxoutput- Format : The format for
IFormattable- Escape : if true escape the value, default is false
Template Format
The template format is Field.
Fields Type Format
- Boolean
- Byte
- Char
- Int16
- Int32
- Int64
- SByte
- UInt16
- UInt32
- UInt64
- Single
- Double
- Decimal
- String
- DateTime
- Enum
License
MIT
OwnersSeay |
AuthorsHsu |
Project URLhttps://github.com/hsu-net/db-export-spreadsheet |
LicenseUnknown |
TagsDatabase Db Export Excel Csv Spreadsheet Hsu |
Info38 total downloads |
| 7 downloads for version 2023.307.24 |
| Download (16.96 KB) |
| Found on the current feed only |
Package history
| Version | Size | Last updated | Downloads | Mirrored? | |||
|---|---|---|---|---|---|---|---|
|
|
2024.410.14-preview141602 | 17.01 KB | Mon, 14 Oct 2024 06:16:17 GMT | 5 |
|
||
|
|
2024.410.12 | 16.99 KB | Sat, 12 Oct 2024 03:31:20 GMT | 3 |
|
||
|
|
2023.307.24 | 16.96 KB | Mon, 24 Jul 2023 15:41:50 GMT | 7 |
|
||
|
|
2023.307.24-preview233257 | 16.98 KB | Mon, 24 Jul 2023 15:33:17 GMT | 5 |
|
||
|
|
2023.307.24-preview231341 | 16.98 KB | Mon, 24 Jul 2023 15:14:04 GMT | 3 |
|
||
|
|
2023.307.24-preview225237 | 16.95 KB | Mon, 24 Jul 2023 14:52:52 GMT | 4 |
|
||
|
|
2023.307.24-preview223238 | 16.91 KB | Mon, 24 Jul 2023 14:32:55 GMT | 6 |
|
||
|
|
2023.307.24-preview190932 | 5.22 KB | Mon, 24 Jul 2023 11:09:51 GMT | 5 |
|