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

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

Closed
cemiley opened this issue Nov 3, 2013 · 5 comments
Closed

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

cemiley opened this issue Nov 3, 2013 · 5 comments

Comments

@cemiley
Copy link

cemiley commented Nov 3, 2013

<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

@redchair123
Copy link

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

@cemiley
Copy link
Author

cemiley commented Nov 3, 2013

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

@redchair123
Copy link

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
#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//issues/38#issuecomment-27655510
.

@cemiley
Copy link
Author

cemiley commented Nov 3, 2013

yes it is correct thank you!

@redchair123
Copy link

@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?

clarketm pushed a commit to clarketm/js-xlsx that referenced this issue Nov 27, 2016
Add simple merge cells capability, saving as range structures (h/t @mchapman)
@SheetJS SheetJS locked and limited conversation to collaborators Feb 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants