{"id":28427261,"url":"https://github.com/paperstrike/db-csv-to-excel","last_synced_at":"2026-03-07T06:31:10.460Z","repository":{"id":290877051,"uuid":"975869877","full_name":"PaperStrike/db-csv-to-excel","owner":"PaperStrike","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-01T07:37:15.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-27T08:09:45.071Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PaperStrike.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2025-05-01T03:52:38.000Z","updated_at":"2025-05-01T07:37:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"e2cca578-e4f4-4100-b2f8-2cad800c875b","html_url":"https://github.com/PaperStrike/db-csv-to-excel","commit_stats":null,"previous_names":["paperstrike/db-csv-to-excel"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PaperStrike/db-csv-to-excel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaperStrike%2Fdb-csv-to-excel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaperStrike%2Fdb-csv-to-excel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaperStrike%2Fdb-csv-to-excel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaperStrike%2Fdb-csv-to-excel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PaperStrike","download_url":"https://codeload.github.com/PaperStrike/db-csv-to-excel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaperStrike%2Fdb-csv-to-excel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30209086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T05:23:27.321Z","status":"ssl_error","status_checked_at":"2026-03-07T05:00:17.256Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2025-06-05T12:10:08.171Z","updated_at":"2026-03-07T06:31:10.429Z","avatar_url":"https://github.com/PaperStrike.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# db-csv-to-excel\n\nA utility package to convert database CSV exports into formatted Excel (XLSX) files.\n\n\u003e README generated by AI. Looks great generally and I manually corrected some apparent errors but hasn't checked it thoroughly. Feel free to report any issues.\n\n## Features\n\n- Convert CSV data to Excel with custom column mapping\n- Support for encrypted database columns (MySQL AES)\n- Custom data processing per column\n- Data sorting capabilities\n- Custom styling for headers and content\n- Configurable column widths\n\n## Installation\n\n```bash\nnpm install db-csv-to-excel\n```\n\n## Basic Usage\n\n```typescript\nimport { convertDBCsvToExcel } from 'db-csv-to-excel'\n\n// Convert CSV to Excel\nawait convertDBCsvToExcel(\n  'input.csv',\n  'output.xlsx',\n  {\n    // Required if any columns are encrypted\n    aesKey: 'your-encryption-key',\n    // Define your database columns\n    dbColumns: [\n      { name: 'id' },\n      { name: 'username' },\n      { name: 'email', encrypted: true },\n      { name: 'created_at', processor: value =\u003e new Date(value) },\n    ],\n    // Define your Excel columns\n    excelColumns: [\n      {\n        title: 'ID',\n        from: row =\u003e row.id,\n        width: 10,\n      },\n      {\n        title: 'User',\n        from: row =\u003e row.username,\n        width: 20,\n      },\n      {\n        title: 'Email Address',\n        from: row =\u003e row.email,\n        width: 30,\n      },\n      {\n        title: 'Registration Date',\n        from: row =\u003e row.created_at.toLocaleDateString(),\n        width: 20,\n      },\n    ],\n    // Set to true if your CSV has a header row\n    csvHasColumns: true,\n    // Set the CSV delimiter if not a comma\n    csvDelimiter: '\\t',\n  },\n)\n```\n\n## API Reference\n\n### `convertDBCsvToExcel()`\n\nMain function to convert CSV to Excel.\n\n```typescript\ndeclare function convertDBCsvToExcel\u003cDBColumns\u003e(\n  inputFilePath: string | URL,\n  outputFilePath: string | URL,\n  options: ConvertParams\u003cDBColumns\u003e\n): Promise\u003cvoid\u003e\n```\n\n### Options\n\n| Parameter | Type | Description | Default |\n|-----------|------|-------------|---------|\n| `dbColumns` | `DBColumn[]` | Database column definitions | *Required* |\n| `excelColumns` | `ExcelColumn[]` \\| `(firstRow?: DBRow) =\u003e ExcelColumn[]` | Excel column definitions, either as array or function that gets first row | *Required* |\n| `aesKey` | `string` | Encryption key for AES-encrypted columns | `''` (Required if any column has `encrypted: true`) |\n| `sortFns` | `Array\u003c(row) =\u003e number\u003e` | Functions to determine sort order | `[]` |\n| `sortMode` | `'asc'` \\| `'desc'` | Sort direction | `'desc'` |\n| `titleStyle` | `CellStyle` | Default style for title cells | `undefined` |\n| `contentStyle` | `CellStyle` | Default style for content cells | `undefined` |\n| `csvHasColumns` | `boolean` | Whether CSV file includes header row | `false` |\n| `csvDelimiter` | `string` | CSV delimiter character | `','` |\n\n### Types\n\n#### `DBColumn\u003cT\u003e`\n\n```typescript\ninterface DBColumn\u003cT = unknown\u003e {\n  name: string\n  encrypted?: boolean\n  processor?: (value: string) =\u003e T\n}\n```\n\n#### `ExcelColumn\u003cDBColumns\u003e`\n\n```typescript\ninterface ExcelColumn\u003cDBColumns\u003e {\n  title: string\n  from: (row: DBRow\u003cDBColumns\u003e) =\u003e string | null | undefined\n  width?: number\n  titleStyle?: CellStyle\n  contentStyle?: CellStyle\n}\n```\n\n## Examples\n\n### Custom Styling\n\n```typescript\nimport { convertDBCsvToExcel } from 'db-csv-to-excel'\n\nawait convertDBCsvToExcel(\n  'input.csv',\n  'output.xlsx',\n  {\n    dbColumns: [/* ... */],\n    excelColumns: [/* ... */],\n    titleStyle: {\n      font: { bold: true, color: { rgb: 'FFFFFF' } },\n      fill: { fgColor: { rgb: '4472C4' } },\n    },\n    contentStyle: {\n      font: { name: 'Arial' },\n    },\n  },\n)\n```\n\n### Sorting\n\n```typescript\nawait convertDBCsvToExcel(\n  'input.csv',\n  'output.xlsx',\n  {\n    dbColumns: [/* ... */],\n    excelColumns: [/* ... */],\n    sortFns: [\n      // Sort by creation date\n      row =\u003e row.created_at.getTime(),\n      // Then by ID\n      row =\u003e Number(row.id),\n    ],\n    // Ascending order\n    sortMode: 'asc',\n  },\n)\n```\n\n### Dynamic Excel Columns\n\nYou can generate Excel columns dynamically based on the first row of data:\n\n```typescript\nawait convertDBCsvToExcel(\n  'input.csv',\n  'output.xlsx',\n  {\n    dbColumns: [/* ... */],\n    // Generate columns dynamically based on first row\n    excelColumns: (firstRow) =\u003e {\n      // Example: Create a column for each property in the first row\n      if (!firstRow) return []\n\n      return Object.keys(firstRow).map(key =\u003e ({\n        title: key.toUpperCase(),\n        from: row =\u003e row[key],\n        width: 15,\n      }))\n    },\n  },\n)\n```\n\n## License\n\nISC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaperstrike%2Fdb-csv-to-excel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaperstrike%2Fdb-csv-to-excel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaperstrike%2Fdb-csv-to-excel/lists"}