{"id":15024800,"url":"https://github.com/jgile/vue-csv-import","last_synced_at":"2025-04-04T13:10:52.591Z","repository":{"id":31866812,"uuid":"129309888","full_name":"jgile/vue-csv-import","owner":"jgile","description":"Vue.js component to select a CSV file, map the columns to fields, and post it somewhere.","archived":false,"fork":false,"pushed_at":"2024-01-27T13:44:35.000Z","size":9715,"stargazers_count":174,"open_issues_count":23,"forks_count":74,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-28T12:04:47.626Z","etag":null,"topics":["csv-import","node","npm","npm-package","vue","vuejs","vuejs2"],"latest_commit_sha":null,"homepage":null,"language":"Vue","has_issues":false,"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/jgile.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"2018-04-12T20:52:04.000Z","updated_at":"2025-03-20T07:28:22.000Z","dependencies_parsed_at":"2024-06-19T01:29:49.460Z","dependency_job_id":"c8b7fbae-b779-4eec-aaf5-974a2fc99dba","html_url":"https://github.com/jgile/vue-csv-import","commit_stats":{"total_commits":148,"total_committers":10,"mean_commits":14.8,"dds":0.6013513513513513,"last_synced_commit":"1dade3d7f0aff90d7f00e9870dcd41df709762ee"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgile%2Fvue-csv-import","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgile%2Fvue-csv-import/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgile%2Fvue-csv-import/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgile%2Fvue-csv-import/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jgile","download_url":"https://codeload.github.com/jgile/vue-csv-import/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247181044,"owners_count":20897344,"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":["csv-import","node","npm","npm-package","vue","vuejs","vuejs2"],"created_at":"2024-09-24T20:00:59.589Z","updated_at":"2025-04-04T13:10:52.575Z","avatar_url":"https://github.com/jgile.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vue.js component to handle CSV uploads with field mapping.\n\n[![Latest Version on NPM](https://img.shields.io/npm/v/vue-csv-import.svg?style=flat-square)](https://npmjs.com/package/vue-csv-import)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n![npm tests](https://github.com/jgile/vue-csv-import/actions/workflows/nodejs.yml/badge.svg)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/jgile/vue-csv-import/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/jgile/vue-csv-import/?branch=master)\n\nThis version is for Vue 3. [Click here for Vue 2](https://github.com/jgile/vue-csv-import/tree/vue2).\n\nVueCsvImport is completely un-styled and customizable. All markup can be replaced and all text can be customized.\n\n[Demo](https://jgile.github.io/vue-csv-import/)\n\n---\n\n## Installation\n\nYou can install the package via npm or yarn:\n\n```bash\n# npm\nnpm install vue-csv-import\n\n# Yarn\nyarn add vue-csv-import\n```\n\nYou can import components individually.\n\n```js\nimport {VueCsvToggleHeaders, VueCsvSubmit, VueCsvMap, VueCsvInput, VueCsvErrors, VueCsvImport} from 'vue-csv-import';\n```\n\nOr import all as a plugin.\n\n```js\nimport {createApp} from \"vue\";\nimport App from \"./App.vue\";\nimport {VueCsvImportPlugin} from \"vue-csv-import\";\n\ncreateApp(App)\n    .use(VueCsvImportPlugin)\n    .mount(\"#app\");\n```\n\nA minimal working example with all components will look something like this:\n\n```vue\n\n\u003ctemplate\u003e\n    \u003cvue-csv-import\n        v-model=\"csv\"\n        :fields=\"{name: {required: false, label: 'Name'}, age: {required: true, label: 'Age'}}\"\n    \u003e\n        \u003cvue-csv-toggle-headers\u003e\u003c/vue-csv-toggle-headers\u003e\n        \u003cvue-csv-errors\u003e\u003c/vue-csv-errors\u003e\n        \u003cvue-csv-input\u003e\u003c/vue-csv-input\u003e\n        \u003cvue-csv-map\u003e\u003c/vue-csv-map\u003e\n    \u003c/vue-csv-import\u003e\n\u003c/template\u003e\n```\n\n---\n\n## Components\n\n- [VueCsvImport](#VueCsvImport) - The primary component wrapper. All other components should be used within this component.\n- [VueCsvToggleHeaders](#VueCsvToggleHeaders) - Toggles whether CSV should be read as having headers or not.\n- [VueCsvInput](#VueCsvInput) - The file input field to upload your CSV\n- [VueCsvMap](#VueCsvMap) - Used to map CSV columns to your fields\n- [VueCsvSubmit](#VueCsvSubmit) - Used to POST the mapped CSV.\n- [VueCsvErrors](#VueCsvErrors) - Used to display errors.\n\n### VueCsvImport\n\nPrimary wrapper component.\n\n```vue\n\n\u003ctemplate\u003e\n    \u003cvue-csv-import\n        v-model=\"csv\"\n        :fields=\"{\n            name: {\n                required: false,\n                label: 'Name'\n            },\n            age: {\n                required: true,\n                label: 'Age'\n            }\n        }\"\n    \u003e\n        \u003c!-- Other Components --\u003e\n    \u003c/vue-csv-import\u003e\n\u003c/template\u003e\n\n```\n\n#### Props:\n\n| Prop          | Default   | Description |\n| ------        | -------   | ----------- |\n| fields        | null      | (required) The field names used to map the CSV. |\n| text          | see below | (optional) Override the default text used in the component. |\n| modelValue    | N/A       | (optional) Binds to the mapped CSV object. |\n\n#### Default text\n\n```json\n{\n    errors: {\n        fileRequired: 'A file is required',\n        invalidMimeType: \"Invalid file type\"\n    },\n    toggleHeaders: 'File has headers',\n    submitBtn: 'Submit',\n    fieldColumn: 'Field',\n    csvColumn: 'Column'\n}\n```\n\n#### Slot Props:\n\n| Prop          | Description |\n| ------        | ----------- |\n| file          | The selected file |\n| errors        | Current errors |\n| fields        | The fields object |\n\n---\n\n### VueCsvToggleHeaders\n\nAllows user to toggle whether the CSV has headers or not.\n\n```vue\n\n\u003ctemplate\u003e\n    \u003cvue-csv-import\u003e\n        ...\n        \u003cvue-csv-toggle-headers\u003e\u003c/vue-csv-toggle-headers\u003e\n        ...\n    \u003c/vue-csv-import\u003e\n\u003c/template\u003e\n```\n\nOr with custom markup:\n\n```vue\n\n\u003ctemplate\u003e\n    \u003cvue-csv-import\u003e\n        ...\n        \u003cvue-csv-toggle-headers v-slot=\"{hasHeaders, toggle}\"\u003e\n            \u003cbutton @click.prevent=\"toggle\"\u003eHas Headers\u003c/button\u003e\n        \u003c/vue-csv-toggle-headers\u003e\n        ...\n    \u003c/vue-csv-import\u003e\n\u003c/template\u003e\n```\n\n#### Props:\n\n| Prop                  | Default   | Description |\n| ------                | -------   | ----------- |\n| checkboxAttributes    | {}        | (optional) Attributes to bind to the checkbox. |\n| labelAttributes       | {}        | (optional) Attributes to bind to the label. |\n\n#### Slot Props:\n\n| Prop          | Description |\n| ------        | ----------- |\n| hasHeaders    | Whether CSV is marked as having headers. |\n| toggle        | Toggle the 'hasHeaders' value. |\n\n---\n\n### VueCsvInput\n\nThe file field for importing CSV.\n\n```vue\n\n\u003ctemplate\u003e\n    \u003cvue-csv-import\u003e\n        ...\n        \u003cvue-csv-input name=\"file\"\u003e\u003c/vue-csv-input\u003e\n        ...\n    \u003c/vue-csv-import\u003e\n\u003c/template\u003e\n```\n\nOr with custom markup:\n\n```vue\n\n\u003ctemplate\u003e\n    \u003cvue-csv-import\u003e\n        ...\n        \u003cvue-csv-input v-slot=\"{file, change}\"\u003e\n            ...\n        \u003c/vue-csv-input\u003e\n        ...\n    \u003c/vue-csv-import\u003e\n\u003c/template\u003e\n```\n\n#### Props:\n\n| Prop          | Default   | Description |\n| ------        | -------   | ----------- |\n| name          | N/A       | (required) The field names used to map the CSV.\n| headers       | true      | (optional) Override the default text used in the component. |\n| parseConfig   | N/A       | (optional) Papaparse config object. |\n| validation    | true      | (optional) Use validation or not |\n| fileMimeTypes | [\"text/csv\", \"text/x-csv\", \"application/vnd.ms-excel\", \"text/plain\"]       | (optional) Accepted CSV file mime types. |\n\n#### Slot Props:\n\n| Prop          | Description |\n| ------        | ----------- |\n| file    | The current file object |\n| change        | Change the file |\n\n---\n\n### VueCsvMap\n\nComponent to map the CSV to the specified fields.\n\n```vue\n\n\u003ctemplate\u003e\n    \u003cvue-csv-import\u003e\n        ...\n        \u003cvue-csv-map\u003e\u003c/vue-csv-map\u003e\n        ...\n    \u003c/vue-csv-import\u003e\n\u003c/template\u003e\n```\n\nOr use slot for custom markup:\n\n```vue\n\n\u003ctemplate\u003e\n    \u003cvue-csv-import\u003e\n        ...\n        \u003cvue-csv-map v-slot=\"{sample, map, fields}\"\u003e\n            ...\n        \u003c/vue-csv-map\u003e\n        ...\n    \u003c/vue-csv-import\u003e\n\u003c/template\u003e\n```\n\n#### Props:\n\n| Prop                | Default   | Description |\n| ------              | -------   | ----------- |\n| noThead             | false     | (optional) Attributes to bind to the checkbox. |\n| selectAttributes    | {}        | (optional) Attributes to bind to the select fields. |\n| autoMatch           | true      | (optional) Auto-match fields to columns when they share the same name |\n| autoMatchIgnoreCase | true      | (optional) Ignore case when auto-matching |\n\n#### Slot Props:\n\n| Prop   | Description |\n| ------ | ----------- |\n| sample | The first row of the CSV. |\n| map    | The currently mapped fields. |\n| fields | The fields. |\n\n---\n\n### VueCsvSubmit\n\nDisplays a button to post the CSV to specified URL.\n\n```vue\n\n\u003ctemplate\u003e\n    \u003cvue-csv-import\u003e\n        ...\n        \u003cvue-csv-submit url=\"/post/here\" :config=\"{}\"\u003e\u003c/vue-csv-submit\u003e\n        ...\n    \u003c/vue-csv-import\u003e\n\u003c/template\u003e\n```\n\nOr use slot for custom markup:\n\n```vue\n\n\u003ctemplate\u003e\n    \u003cvue-csv-import\u003e\n        \u003cvue-csv-submit v-slot=\"{submit, mappedCsv}\"\u003e\n            \u003cbutton @click.prevent=\"submit\"\u003eSubmit!!\u003c/button\u003e\n        \u003c/vue-csv-submit\u003e\n    \u003c/vue-csv-import\u003e\n\u003c/template\u003e\n```\n\n#### Props:\n\n| Prop   | Default   | Description |\n| ------ | -------   | ----------- |\n| url    | N/A       | (required) Where to post the CSV. |\n| config | {}       | (optional) Axios config object. |\n\n#### Slot Props:\n\n| Prop          | Description |\n| ------        | ----------- |\n| submit        | Submit the CSV (POST) |\n| mappedCsv     | The mapped CSV object |\n\n---\n\n### VueCsvErrors\n\nDisplays any error messages.\n\n```vue\n\n\u003ctemplate\u003e\n    \u003cvue-csv-import\u003e\n        ...\n        \u003cvue-csv-errors\u003e\u003c/vue-csv-errors\u003e\n        ...\n    \u003c/vue-csv-import\u003e\n\u003c/template\u003e\n```\n\nOr use slot for custom markup:\n\n```vue\n\n\u003ctemplate\u003e\n    \u003cvue-csv-import\u003e\n        ...\n        \u003cvue-csv-errors v-slot=\"{errors}\"\u003e\n            ...\n        \u003c/vue-csv-errors\u003e\n        ...\n    \u003c/vue-csv-import\u003e\n\u003c/template\u003e\n```\n\n#### Slot Props:\n\n| Prop          | Description |\n| ------        | ----------- |\n| errors        | Object containing errors |\n\n---\n\n### Testing\n\n```bash\nnpm run test\n```\n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n### Security\n\nIf you discover any security related issues, please contact John Gile.\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n## Credits\n\n- [John Gile](https://github.com/jgile)\n- [All Contributors](../../contributors)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgile%2Fvue-csv-import","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjgile%2Fvue-csv-import","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgile%2Fvue-csv-import/lists"}