Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xlsx to json to API #12

Open
emond07 opened this issue May 3, 2020 · 1 comment
Open

xlsx to json to API #12

emond07 opened this issue May 3, 2020 · 1 comment

Comments

@emond07
Copy link

emond07 commented May 3, 2020

Hi,

Can we have sample for converting xlsx to json then post to Api per row/or bulk?
Thanks

@marianomd
Copy link

You have to listen to the parsed event:

<xlsx-read :file="file" @parsed="parsed">

And then you can iterate over the parsed data:

methods: {
            onChange(event) {
                this.file = event.target.files ? event.target.files[0] : null;
            },
            parsed(event) {
                let sheet = event.SheetNames[0];
                let row = 4;
                while (true) {
                    let cell = event.Sheets[sheet]['C' + row];
                    if (!cell || !cell.v) break;
                    console.log(cell.v);
                    row++;
                }
            }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants