Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-spread-sheet-excel

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-spread-sheet-excel

A quick example of rendering large lists of inputs in table using React JS and Redux

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
increased by125%
Maintainers
1
Weekly downloads
 
Created
Source

React-spread-sheet-excel

Render large lists of input boxes in the table using React JS and Redux, Render a table with a large number of rows and columns.

  • Can render a large number of input boxes in the table
  • Customizable header values
  • Resize columns
  • Can Use as a Spreadsheet or Excel with react
  • Read-only mode
  • Export to CSV support
  • Calculations Support
  • Move between cells using tab/shift+tab or arrow Keys keys on the keyboard
  • Supports calculations in Excel cells
  • Sticky Headers

Getting Started

Input data format

[
  [{value: 1},{value: 1},{value: "a"},{value: "b"},{value: "d"}]
]
npm install react-spread-sheet-excel

demo

Live demo

alt text

import React, { useRef, useState } from "react";
import Sheet, { SheetRef } from "./lib";
import packageConf from "../package.json";

const createData = () => {
  const val: any[][] = [];
  for (let i = 0; i < 2000; i++) {
    val.push(Array.from({ length: 40 }, () => Math.floor(Math.random() * 10)));
  }
  return val;
};
function App() {
  const [state] = useState<any[][]>(createData());
  const childRef = useRef<SheetRef>(null);
  const onChange = (i: number, j: number, value: string) => {
    //Do not try to update state with this action, it will slow down your application
    console.log(`Value Updated at ${j}, ${j}`, value);
  };
  const getData = () => {
    console.log("Updated Data", childRef?.current?.getData()); 
  };

  return (
    <div>
      <div>
        <button onClick={getData}>Get Updated data</button>
      </div>
      <div>
        <Sheet data={state} onChange={onChange} ref={childRef} />
      </div>
    </div>
  );
}

export default App;


props

PropDescriptionDefaultMandatorytype
dataArray of array with values (matrix)[[]]Noany[][]
onChangeCalls when a change is detected in input boxes, Do not set render component when value changes, the component should be uncontrolledNo
resizeshow column resize optionfalseNoboolean
hideXAxisHeaderShow serial numbers in X axisfalseNoboolean
hideYAxisHeaderShow serial numbers in Y axisfalseNoboolean
headerValuesarray of header values, Number in header values could affect calculationsalphabetsNostring[]

Ref

RefDescription
getDataGet updated data from sheet
setDataSet new data to sheet

Sojin Antony

Acknowledgments

  • React-intersection-observer
  • Redux, React Redux

Keywords

FAQs

Package last updated on 21 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc