Uncaught TypeError: Cannot call method 'getTypeOf' of undefined #38

Closed
opened 2013-11-03 21:32:29 +00:00 by cemiley · 5 comments
cemiley commented 2013-11-03 21:32:29 +00:00 (Migrated from github.com)
<script lang="javascript" src="C:/Users/003347/Desktop/xlsx.js"></script>
<script lang="javascript" src="C:/Users/003347/Desktop/jszip-load.js"></script>
<script lang="javascript" src="C:/Users/003347/Desktop/jszip-inflate.js"></script>
<script lang="javascript" src="C:/Users/003347/Desktop/jszip-deflate.js"></script>

function getXLSX(readFile) {

              var reader = new FileReader();

              // Read file into memory as UTF-16      
              reader.readAsArrayBuffer(readFile);

              // Handle progress, success, and errors                
              reader.onload = loaded;
            }


 function loaded(evt) {   
  var data = evt.target.result;
  //var xlsx = XLSX.read(data, {type: 'binary'});
  var arr = String.fromCharCode.apply(null, new Uint8Array(data));
 var xlsx = XLSX.read(btoa(arr), {type: 'base64'});
  process_xlsx(xlsx);
             }

function process_xlsx(xlsx) {
var output = "";

output = to_csv(xlsx);

if(out.innerText === undefined) out.textContent = output;
else out.innerText = output;
}

function to_csv(workbook) {
var result = [];
workbook.SheetNames.forEach(function(sheetName) {
var rObjArr = XLSX.utils.sheet_to_csv(workbook.Sheets[sheetName]);
if(rObjArr.length > 0){
result.push("SHEET: " + sheetName);
result.push("");
result.push(rObjArr);
}
});
return result.join("\n");
}

while reading with 'readAsBinaryString' xlsx file that consists of numbers i got "Uncaught TypeError: Cannot call method 'getTypeOf' of undefined"
when reading with 'readAsArrayBuffer' this time i got 'Uncaught TypeError: Cannot call method 'decode' of undefined '.Could you please help me what should we import and how should code be whille reading XLSX?i try many version of this link http://www.javascriptoo.com/js-xlsx but doesn't work

<script lang="javascript" src="C:/Users/003347/Desktop/jszip.js"></script> ``` <script lang="javascript" src="C:/Users/003347/Desktop/xlsx.js"></script> <script lang="javascript" src="C:/Users/003347/Desktop/jszip-load.js"></script> <script lang="javascript" src="C:/Users/003347/Desktop/jszip-inflate.js"></script> <script lang="javascript" src="C:/Users/003347/Desktop/jszip-deflate.js"></script> ``` function getXLSX(readFile) { ``` var reader = new FileReader(); // Read file into memory as UTF-16 reader.readAsArrayBuffer(readFile); // Handle progress, success, and errors reader.onload = loaded; } function loaded(evt) { var data = evt.target.result; //var xlsx = XLSX.read(data, {type: 'binary'}); var arr = String.fromCharCode.apply(null, new Uint8Array(data)); var xlsx = XLSX.read(btoa(arr), {type: 'base64'}); process_xlsx(xlsx); } ``` function process_xlsx(xlsx) { var output = ""; ``` output = to_csv(xlsx); ``` if(out.innerText === undefined) out.textContent = output; else out.innerText = output; } function to_csv(workbook) { var result = []; workbook.SheetNames.forEach(function(sheetName) { var rObjArr = XLSX.utils.sheet_to_csv(workbook.Sheets[sheetName]); if(rObjArr.length > 0){ result.push("SHEET: " + sheetName); result.push(""); result.push(rObjArr); } }); return result.join("\n"); } while reading with 'readAsBinaryString' xlsx file that consists of numbers i got "Uncaught TypeError: Cannot call method 'getTypeOf' of undefined" when reading with 'readAsArrayBuffer' this time i got 'Uncaught TypeError: Cannot call method 'decode' of undefined '.Could you please help me what should we import and how should code be whille reading XLSX?i try many version of this link http://www.javascriptoo.com/js-xlsx but doesn't work
Niggler commented 2013-11-03 21:36:20 +00:00 (Migrated from github.com)

The page appears to be an older version of the code. Can you try the latest version (http://sheetjs.github.io/js-xlsx/) and let me know if you see the same errors

[The page](http://www.javascriptoo.com/js-xlsx) appears to be an older version of the code. Can you try the latest version (http://sheetjs.github.io/js-xlsx/) and let me know if you see the same errors
cemiley commented 2013-11-03 21:52:51 +00:00 (Migrated from github.com)

now i can read xlsx but it gives this error "Unrecognized key in Heading Pairs: Çalışma Sayfaları "

now i can read xlsx but it gives this error "Unrecognized key in Heading Pairs: Çalışma Sayfaları "
Niggler commented 2013-11-03 22:26:08 +00:00 (Migrated from github.com)

That's just console output (mostly because the files themselves use
keywords in the local version):

https://github.com/SheetJS/js-xlsx/blob/gh-pages/xlsx.js#L639

                            default: console.error("Unrecognized

key in Heading Pairs: " + v[i++].v);

For example, in german, the name "Worksheets" is actually rendered as
"arbeitsblätter". (See related PR
https://github.com/SheetJS/js-xlsx/pull/32)

Can you verify if the actual content correct?

On Sun, Nov 3, 2013 at 1:52 PM, cemiley notifications@github.com wrote:

now i can read xlsx but it gives this error "Unrecognized key in Heading
Pairs: Çalışma Sayfaları "


Reply to this email directly or view it on GitHubhttps://github.com/SheetJS/js-xlsx/issues/38#issuecomment-27655510
.

That's just console output (mostly because the files themselves use keywords in the local version): https://github.com/SheetJS/js-xlsx/blob/gh-pages/xlsx.js#L639 ``` default: console.error("Unrecognized ``` key in Heading Pairs: " + v[i++].v); For example, in german, the name "Worksheets" is actually rendered as "arbeitsblätter". (See related PR https://github.com/SheetJS/js-xlsx/pull/32) Can you verify if the actual content correct? On Sun, Nov 3, 2013 at 1:52 PM, cemiley notifications@github.com wrote: > now i can read xlsx but it gives this error "Unrecognized key in Heading > Pairs: Çalışma Sayfaları " > > — > Reply to this email directly or view it on GitHubhttps://github.com/SheetJS/js-xlsx/issues/38#issuecomment-27655510 > .
cemiley commented 2013-11-03 22:44:29 +00:00 (Migrated from github.com)

yes it is correct thank you!

yes it is correct thank you!
Niggler commented 2013-11-03 22:54:12 +00:00 (Migrated from github.com)

@cemiley The warning has been removed in master so I will mark this closed. However, I would like to see the file. Could you possibly email the file (sheetjs@gmail.com) so I can see exactly what that was supposed to say?

@cemiley [The warning has been removed in master](https://github.com/SheetJS/js-xlsx/commit/1625534e8d30369c5c1a564b4d1cf91efc3caf7d#diff-a95fc84720d4028ec17a7f90d2e58901L634) so I will mark this closed. However, I would like to see the file. Could you possibly email the file (sheetjs@gmail.com) so I can see exactly what that was supposed to say?
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#38
No description provided.