{"id":15653149,"url":"https://github.com/svrnm/exceldatatables","last_synced_at":"2025-05-07T13:04:12.544Z","repository":{"id":19729957,"uuid":"22986097","full_name":"svrnm/exceldatatables","owner":"svrnm","description":"Replace a worksheet within an Excel workbook (.xlsx) without changing any other properties of the file.","archived":false,"fork":false,"pushed_at":"2024-07-16T14:54:15.000Z","size":172,"stargazers_count":30,"open_issues_count":1,"forks_count":19,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-07T13:04:07.021Z","etag":null,"topics":["data","datatable","excel","php","xlsx"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/svrnm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2014-08-15T10:16:23.000Z","updated_at":"2024-07-16T14:54:18.000Z","dependencies_parsed_at":"2024-07-16T17:55:20.999Z","dependency_job_id":null,"html_url":"https://github.com/svrnm/exceldatatables","commit_stats":{"total_commits":24,"total_committers":8,"mean_commits":3.0,"dds":0.375,"last_synced_commit":"cc3511c6573da8a9900a22043990047ecb7dce9a"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svrnm%2Fexceldatatables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svrnm%2Fexceldatatables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svrnm%2Fexceldatatables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svrnm%2Fexceldatatables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/svrnm","download_url":"https://codeload.github.com/svrnm/exceldatatables/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252883227,"owners_count":21819158,"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","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":["data","datatable","excel","php","xlsx"],"created_at":"2024-10-03T12:44:49.483Z","updated_at":"2025-05-07T13:04:12.521Z","avatar_url":"https://github.com/svrnm.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ExcelDataTables\n\nReplace a worksheet within an Excel workbook (`.xlsx`) without changing any\nother properties of the file.\n\n## License\n\nThis program is free software; see [LICENSE](./LICENSE) for more details.\n\n## Details\n\nThe main purpose of this library is adding a \"data table\" to an existing excel\nfile without modifying any other components. This is especially useful if you\nhave a template file, e.g. for reporting including \"advanced\" features like\ncharts, pivot tables, macros and you'd like to change a base data table within a\nPHP application.\n\n## Setup\n\nUse composer to add this repository to your dependencies:\n\n```JSON\n{\n  \"require\": {\n    \"svrnm/exceldatatables\": \"dev-master\"\n  }\n}\n```\n\nIf you use the [Laravel framework](https://laravel.io/) you can additionally add\nthe `ServiceProvider` to your `config/app.php`:\n\n```PHP\n...\n'providers' =\u003e array(\n  ...\n  'Svrnm\\ExcelDataTables\\ExcelDataTablesServiceProvider'\n)\n...\n```\n\n## Example\n\nThe following example demonstrates how to use ExcelDataTables. The following is\nalso contained as `example.php` within the folder `examples/`:\n\n```php\n\u003c?php\n  require_once('../vendor/autoload.php');\n  // Create a new instance\n  $dataTable = new Svrnm\\ExcelDataTables\\ExcelDataTable();\n  // Specify the source file\n  $in = 'spec.xlsx';\n  // Specify the output file\n  $out = 'test.xlsx';\n  // Specify the data for the worksheet.\n  $data = array(\n    array(\"Date\" =\u003e new \\DateTime('2014-01-01 13:00:00'), \"Value 1\" =\u003e 0, \"Value 2\" =\u003e 1),\n    array(\"Date\" =\u003e new \\DateTime('2014-01-02 14:00:00'), \"Value 1\" =\u003e 1, \"Value 2\" =\u003e 0),\n    array(\"Date\" =\u003e new \\DateTime('2014-01-03 15:00:00'), \"Value 1\" =\u003e 2, \"Value 2\" =\u003e -1),\n    array(\"Date\" =\u003e new \\DateTime('2014-01-04 16:00:00'), \"Value 1\" =\u003e 3, \"Value 2\" =\u003e -2),\n    array(\"Date\" =\u003e new \\DateTime('2014-01-05 17:00:00'), \"Value 1\" =\u003e 4, \"Value 2\" =\u003e -3),\n  );\n  // Attach the data table and copy the new xlsx file to the output file.\n  $dataTable-\u003eshowHeaders()-\u003eaddRows($data)-\u003eattachToFile($in, $out);\n?\u003e\n```\n\nIn this example the method `attachToFile` creates a new excel file. If you use\nthis library within a web application you might prefer the `fillXLSX()` function\nwhich returns a string representation of the excel document. The following\nexamples demonstrates this case within a Laravel application\n\n```php\n\u003c?php\n  class ReportController extends Controller {\n    protected $dataTable;\n\n     public function __construct(\\Svrnm\\ExcelDataTables\\ExcelDataTable $dataTable) {\n         $this-\u003edataTable = $dataTable;\n  }\n\n  public function show($month) {\n   $data = DB::select('select date,value1,value2 from reporting where MONTH(date) = ?', array($month));\n   $path = storage_path() . '/reports/example.xlsx';\n   $xlsx = $this-\u003edataTable-\u003eshowHeaders()-\u003eaddRows($data)-\u003efillXLSX($path);\n   return Response::make($xlsx, 200, array(\n    'Content-Type' =\u003e 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n    'Content-Disposition' =\u003e 'attachment; filename=\"report.xlsx\"',\n    'Content-Length' =\u003e strlen($xlsx)\n   ));\n   // ...\n  }\n }\n?\u003e\n```\n\n## Contact\n\nFor any questions you can contact Severin Neumann\n\u003cseverin.neumann@altmuehlnet.de\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvrnm%2Fexceldatatables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsvrnm%2Fexceldatatables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvrnm%2Fexceldatatables/lists"}