Тёмный

How to Convert Excel file into JSON by using Angular | JavaScript | JSON 

Code Pro
Подписаться 2,7 тыс.
Просмотров 20 тыс.
50% 1

Initially, when I started working on this requirement, people suggested using any one of the backend libraries to read and convert the excel data into JSON objects. But it is difficult to send requests to the server every time. On the other hand, it was really easy to convert the excel file on the client into a JSON object by using pure JavaScript.
There is a JavaScript plugin XSLX that can be used to read excel files as binary strings and to convert them into JSON objects.
We can read the data in the excel file by using a file reader as a binary string in JavaScript. Then we use XLSX which has a built-in facility of SheetJS to convert our binary string into a JSON object.

Опубликовано:

 

1 июл 2021

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 23   
@GauravSharma-gr4bs
@GauravSharma-gr4bs Год назад
Thanks for sharing the technique, it's easy to understand and descriptive.
@Oneslothj
@Oneslothj 2 года назад
woah amazing friend, this works for me 100%, I think just add how to drop a file(because for me didn't work or maybe it's just adding something in the html) and it will be the most complete video about this topic thanks
@JohnPico2020
@JohnPico2020 2 года назад
gracias, muy buen video :)
@nandagopalsutradhar5200
@nandagopalsutradhar5200 3 года назад
excellent job
@randallerasmus
@randallerasmus 3 года назад
Nice job man, you have another subscriber! Would you mind showing how to generate the converted json file to folder on the project and not in the dom
@vinithkumar2319
@vinithkumar2319 2 года назад
Thanks a ton ;
@alexandercodes
@alexandercodes 2 года назад
Amazing
@azamnawaz5836
@azamnawaz5836 2 года назад
Nicely Done Bro
@sonidosdetranquilidad
@sonidosdetranquilidad Год назад
Thank you
@BillMoman
@BillMoman Год назад
Do you know if there is a way to convert the Json to a typed object. I tried sheet_to_json, but the json is still just an object and it doesn't know that it is MyModel. It knows it from an intellisense standpoint because typescript is loosely coupled. However, when I try to validate the model using class-validator, it doesn't validate anything because it doesn't know the actual model to look at. I'm trying to do it as generically as possible so I can reuse the code. In other words, I don't want to use Object.assign(MyModel, jsonObject) in order to get it to work because I need MyModel to be generic.
@vamshichekka2892
@vamshichekka2892 3 года назад
Can you please tell me how to access the JSON object out of that method. Even though I assign it to global variable, but it is not accessible after the method.. please help me here
@manojradharapu4688
@manojradharapu4688 Год назад
How to validate the values after reading? Suppose in your excel file you are having InsVal - its value should be number but what if user enter a-z characters ? How to handle
@kiranbegari811
@kiranbegari811 3 года назад
can you share the how to convert the excel to json data with using the react please tel me
@LeandroTercette
@LeandroTercette 2 года назад
new subscriber here !
@alradiation5417
@alradiation5417 3 года назад
why u dont have any error in "let binaryData = event.target.result" that the object is possibly null
@nandagopalsutradhar5200
@nandagopalsutradhar5200 3 года назад
100% working...
@CodePro-Jayanth
@CodePro-Jayanth 3 года назад
Thanks and pls subscribe to my channel
@MrChakri80
@MrChakri80 Год назад
The expiry date is not showing the correct format. How can we resolve this date and time format issue?
@vishnuvirat2501
@vishnuvirat2501 2 года назад
Bro How to use in Require js. In Require Js it's showing error.
@kalaivanik8076
@kalaivanik8076 Год назад
Will it work for multiple sheets as well ?
@MYPECOV4Media
@MYPECOV4Media Год назад
Hi bro u can share ur project plz? nice tutorial
@aguadepueblaparatodos862
@aguadepueblaparatodos862 Год назад
Like
Далее
Learn JSON in 10 Minutes
12:00
Просмотров 3,1 млн
skibidi toilet 76 (full episode)
08:11
Просмотров 8 млн
ПОЮ НАРОДНЫЕ ПЕСНИ🪗
3:19:41
Просмотров 1,8 млн
What happened to Bluelearn? Final Thoughts
9:04
Просмотров 2,7 тыс.
How to Make Forms in Angular REUSABLE (Advanced, 2023)
21:10
Learn TypeScript Generics In 13 Minutes
12:52
Просмотров 240 тыс.
Save Excel Table to a JSON File with Simple VBA Macro
20:00
How Angular Signals and RxJS Work Together
16:15
Просмотров 27 тыс.
What is Observable | Observables | Angular 12+
14:16
Просмотров 148 тыс.
Why Signals Are Better Than React Hooks
16:30
Просмотров 463 тыс.