{"id":21140806,"url":"https://github.com/parkejunior/spreadsheetmr","last_synced_at":"2025-03-14T13:13:33.895Z","repository":{"id":57035967,"uuid":"329012774","full_name":"parkejunior/spreadsheetmr","owner":"parkejunior","description":"Multiformat spreadsheet reader.","archived":false,"fork":false,"pushed_at":"2021-01-12T18:08:22.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-21T06:46:28.724Z","etag":null,"topics":["composer-library","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/parkejunior.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-12T14:29:51.000Z","updated_at":"2021-01-12T20:04:34.000Z","dependencies_parsed_at":"2022-08-23T20:50:50.686Z","dependency_job_id":null,"html_url":"https://github.com/parkejunior/spreadsheetmr","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parkejunior%2Fspreadsheetmr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parkejunior%2Fspreadsheetmr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parkejunior%2Fspreadsheetmr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parkejunior%2Fspreadsheetmr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parkejunior","download_url":"https://codeload.github.com/parkejunior/spreadsheetmr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243581092,"owners_count":20314167,"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":["composer-library","php"],"created_at":"2024-11-20T07:18:10.398Z","updated_at":"2025-03-14T13:13:33.866Z","avatar_url":"https://github.com/parkejunior.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SpreadSheetMR\n\nSpreadSheetMR is a simple multiformat spreadsheet reader.\n\n  - Read XLSX, XLS, CSV or TXT files\n  - Combine header with data\n  - Ignore row or columns\n\nThis library uses [`shuchkin/SimpleXLS`](https://github.com/shuchkin/simplexls) and [`shuchkin/SimpleXLSX`](https://github.com/shuchkin/simplexlsx) for read Excel files.\n\n# Installation\n\nFirst, you will need to install [Composer](http://getcomposer.org/). Then, run the following command:\n\n```bash\n$ composer install parkejunior/spreadsheetmr\n```\n\n\n# Usage\n\n## Basic\nHere is a basic example of using the library:\n```php\nuse SpreadSheetMR\\SpreadSheetMR;\n\n$path_to_file = \"file.csv\";\n$file_extension = \".csv\"; // or only \"csv\"\n$import = new SpreadSheetMR($path_to_file, $file_extension);\n$data = $import-\u003egetObject();\n\nvar_dump($data);\n```\n\nThe `getObject` method get data formatted using `stdClass`.\nNote that the file extension is passed as a separate property from the file path, because the path can be temporary like the superglobal `$_FILES['file']['tmp_name']`.\n\n## Verify header and limits\n\nYou can use the `verifyFile()` method by passing an array with some settings. Example:\n```php\n...\n\n$import-\u003everifyFile(array(\n\t\"first_title\" =\u003e \"name\", // check if first title on header is \"name\"\n\t\"last_title\" =\u003e \"phone\", // check if last title on header is \"phone\"\n\t\"total_columns\" =\u003e 4  // check if total columns on header is 4\n));\n$data = $import-\u003egetObject();\n\nvar_dump($data);\n```\n\n## Ignore row and columns\n\nIt is also possible to ignore columns or rows using the `ignoreRow()` and `ignoreColumn()` methods by passing the index offset as a parameter. Example:\n```php\n...\n\n$import-\u003eignoreRow(3); // ignore 4th row\n$import-\u003eignoreColumn(0); // ignore first column\n$data = $import-\u003egetObject();\n\nvar_dump($data);\n```\n\n## Define which row is the header\n\nYou can define which line is the header by passing to the `headerIndex` property the index offset of the line. Note that when the header is defined, the `getObject ()` method returns a `stdClass` combining the header as an association to the data of each line. Example:\n```php\n...\n\n$import-\u003eheaderIndex = 0; // define first row as header\n$data = $import-\u003egetObject();\n\nvar_dump($data);\n```\n\n# Contribution\nIf you find any incorrect English grammar or any suggestions on how to improve the library, I appreciate it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparkejunior%2Fspreadsheetmr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparkejunior%2Fspreadsheetmr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparkejunior%2Fspreadsheetmr/lists"}