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

Column empty and not being processed when top row's cell is empty #643

Open
jaycoolslm opened this issue Jun 24, 2024 · 2 comments
Open

Comments

@jaycoolslm
Copy link

Ref #593

Describe the bug
Column is not being pulled through into dataframe
When uploading an excel which has the topmost row empty for a given column, that column will not come throw

To Reproduce
Steps to reproduce the behavior:

  1. Create an excel which has headers and the top most row for column X is empty
  2. dfd.readExcel
  3. console.log(df.columns)
  4. See column missing

Expected behavior
The column should be there

Desktop (please complete the following information):

  • OS: MacOS
  • Browser Safari
  • Version 1.1.2
@jaycoolslm
Copy link
Author

This is likely to be an issue with https://docs.sheetjs.com/docs/api/parse-options/

@jaycoolslm
Copy link
Author

jaycoolslm commented Jun 24, 2024

This can be resolved on the sheetjs level using this solution

https://stackoverflow.com/a/66859139

Danfo team - I would suggest extending the current ExcelInputOptionsBrowser object to include an object that can be spread out as args when calling this function

utils.sheet_to_json(worksheet)

I will raise a PR for this if I have time

PS: my current working implementation:

// parse excel using XLSX
    const arrBuf = await file.arrayBuffer();
		const arrBufInt8 = new Uint8Array(arrBuf);
		const workbook = XLSX.read(arrBufInt8, { type: 'array' });
		const worksheet = workbook.Sheets[workbook.SheetNames[0]];
		const data = XLSX.utils.sheet_to_json(worksheet, { defval: '' });
		// instantiate new dataframe
    let df = new dfd.DataFrame(data)

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

1 participant