Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. reader.onload = function (e: any) {
  2. var data = e.target.result;
  3. console.log(data);
  4. var result;
  5. var workbook = XLSX.read(data, { type: 'binary' });
  6. var sheet_name_list = workbook.SheetNames;
  7.  
  8. sheet_name_list.forEach(function (y) { /* iterate through sheets */
  9. //Convert the cell value to Json
  10. var roa = XLSX.utils.sheet_to_json(workbook.Sheets[y]);
  11. if (roa.length > 0) {
  12. result = roa;
  13. }
  14. });
  15.  
  16. result.forEach(element => {
  17. if (element.Permissao == "2") {
  18. element.Permissao = "Usuário Comum";
  19. }
  20. else if (element.Permissao == "1") {
  21. element.Permissao = "Administrador";
  22. }
  23. });
  24. //Get the first column first cell value;
  25. _component.validationFiles(result);
  26.  
  27. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement