Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/victorboissiere/vue-xls-csv-parser
Simple VueJS component to parse XLS/CSV files with validation
https://github.com/victorboissiere/vue-xls-csv-parser
csv parser vuejs xlsx
Last synced: about 2 months ago
JSON representation
Simple VueJS component to parse XLS/CSV files with validation
- Host: GitHub
- URL: https://github.com/victorboissiere/vue-xls-csv-parser
- Owner: victorboissiere
- Created: 2017-06-16T14:19:11.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T01:15:04.000Z (about 2 years ago)
- Last Synced: 2024-10-29T23:44:17.567Z (2 months ago)
- Topics: csv, parser, vuejs, xlsx
- Language: JavaScript
- Homepage:
- Size: 10.8 MB
- Stars: 28
- Watchers: 5
- Forks: 23
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Vue XLS/CSV parser
## Description
This npm package will help you parse XLS/CSV files and validate them. The user will be asked to associate his file columns with the columns you require. Once validated, an event will be triggered where you will be able to get only the data you need.
![Demo](wiki/demo.gif)
## Requirements
You will need Bootstrap 3.x. It has not been tested yet with Boostrap 4.
## Components
### XlsCsvParser
#### Props
| Name | Type | Description |
| ------------ |:-------------:| -----:|
| columns (required) | Array | An array of object representing the columns you required: `[{ name: 'Student login', value: 'login', isOptional: false }]` |
| validateButtonId | String | The id of the custom validate button. The component validation button will not be displayed |
| help | String | Help text shown on the file dropzone |
| lang | String | `en`, `nl` or `fr`. Default: `en` |#### Events
- `onValidate(results)`: all the data parsed by the component and returned after the user validation
#### Example usage
```html
Example - Import file with required login, firstname, lastname and optional values
Results:
{{ JSON.stringify(results, null, 2) }}
import { XlsCsvParser } from 'vue-xls-csv-parser';
export default {
name: 'App',
components: {
XlsCsvParser,
},
methods: {
onValidate(results) {
this.results = results;
},
},
data() {
return {
columns: [
{ name: 'Student login', value: 'login' },
{ name: 'Student firstname', value: 'firstname' },
{ name: 'Student lastname', value: 'lastname' },
{ name: 'Other', value: 'other', isOptional: true },
],
results: null,
help: 'Necessary columns are: login, firstname and lastname',
};
},
};```
## Tests
Simpliy run `yarn mocha`.
## Build Setup
``` bash
# install dependencies
yarn intall# serve with hot reload at localhost:8080
yarn start# build for a release
yarn bundle:dist
```