Edit worksheet that contain protected cell, cause the result cell filled with NAN #891

Closed
opened 2017-11-20 01:28:43 +00:00 by mgoku · 3 comments
mgoku commented 2017-11-20 01:28:43 +00:00 (Migrated from github.com)

Hi,

I have a workbook (attached: items_2017-10-04.xlsx) that contain some protected cell inside the worksheet. I can read the protected cell, but can't edit it.

I use js-xlsx to manipulate some of the unprotected cell, and then save the workbook to a new file.

Everything work fine. The protected cell lost it's protected status, but it doesn't matter for my use case.

The only problem is, if the protected cell is empy, then the same cell at the new file will be filled with NaN text.

Hi, I have a workbook (attached: [items_2017-10-04.xlsx](https://github.com/SheetJS/js-xlsx/files/1486209/items_2017-10-04.xlsx)) that contain some protected cell inside the worksheet. I can read the protected cell, but can't edit it. I use js-xlsx to manipulate some of the unprotected cell, and then save the workbook to a new file. Everything work fine. The protected cell lost it's protected status, but it doesn't matter for my use case. The only problem is, if **the protected cell is empy**, then the same cell at the new file will be filled with `NaN` text.
SheetJSDev commented 2017-11-20 01:46:46 +00:00 (Migrated from github.com)

The worksheet has many cells that are explicitly marked as number but have no data or formula. We'll push a fix shortly.

The worksheet has many cells that are explicitly marked as number but have no data or formula. We'll push a fix shortly.
SheetJSDev commented 2017-11-20 02:24:12 +00:00 (Migrated from github.com)

Once the tests pass, we'll push the release to NPM.

The empty cells will not be generated by default when you read the workbook, so you may have to go back and create new cell objects if you intended to write to one of those cells. For example, G3 is empty. You can add it back by setting the worksheet G3 property to a cell:

workbook.Sheets['Sheet1']['G3'] = { t:'n', v:12345 };

You can force cell object generation by setting sheetStubs:true, but those will show up as stubs like { t: 'z' }, so you'd have to set the type to 'n' whenever you want to assign a value.

Once the tests pass, we'll push the release to NPM. The empty cells will not be generated by default when you read the workbook, so you may have to go back and create new cell objects if you intended to write to one of those cells. For example, G3 is empty. You can add it back by setting the worksheet G3 property to a cell: ```js workbook.Sheets['Sheet1']['G3'] = { t:'n', v:12345 }; ``` You can force cell object generation by setting `sheetStubs:true`, but those will show up as stubs like `{ t: 'z' }`, so you'd have to set the type to `'n'` whenever you want to assign a value.
mgoku commented 2017-11-20 06:28:52 +00:00 (Migrated from github.com)

Yes. Thank you.

Yes. Thank you.
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#891
No description provided.