React implementation for JS-XLSX In-Browser HTML Table Edit Demo #1960
Labels
No Label
DBF
Dates
Defined Names
Features
Formula
HTML
Images
Infrastructure
Integration
International
ODS
Operations
Performance
PivotTables
Pro
Protection
Read Bug
SSF
SYLK
Style
Write Bug
good first issue
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#1960
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I want to know if there is any implementation of the demo https://sheetjs.com/demo/modify.html in react. I am new to React and want to implement the similar functionality.
The modify demo is fairly simplistic.
When the file is read, the first worksheet is rendered to an HTML TABLE. On export, the table data is scraped and the resulting file is exported.
You can do this in react by using a ref on the container element. On read, you would set the innerHTML directly. On write, the ref gives you easy access to the live dom element.
I tried the demo, and noticed that when I dropped my own Excel file and changed around the contents, the resulting downloaded file will contain the unchanged data instead.
I'm down to do this, but I just wanted some feedback on what I think are the expectations. Would it be to recreate the existing demo, but fully functioning with modern React code, such as using hooks (v16.8+)? Is there an existing code style? I would use
prettier
, if none is specified.Also, is the React demo on the deployed docs? I can't find a way to navigate to it.
@tarikhamilton the demos are not "deployed" anywhere. for react, you can spin up a local web server (with
python -mSimpleHTTPServer
ornpx http-server
).Instead of working through HTML, it's probably better to demo an editable grid component that is built specifically for react. Instead of pulling from the rendered grid, it would be better to use the underlying state. The "read" part of the demo would update the state based on the data in the file while the "write" part would extract the state and generate a workbook.
One open question is whether to create an external demo or contribute code to the projects directly. For example,
react-data-grid
demo page has an export and it might make sense to contribute an importer there. Forreact-table
,react-table-plugins
has an export so it may make sense to contribute.I vote contributing to the projects directly. @tarikhamilton what's the update? Do you need help?
Demo using fetch to parse and update a
react-data-grid
: https://codesandbox.io/s/quiet-cookies-9j7ksf443aa8 shows
react-data-grid
, including switching between worksheets and writing the entire modified workbook. Thanks @0xc0Der !