@nour-elgeziry/csv_controller
v0.1.5
Published
The CSV Controller is an npm package that allows users to upload CSV files and extract specific data. With this package, you can easily retrieve data from CSV files and perform further processing. Currently the first version supports extracting data from
Downloads
2
Readme
CSV Controller
The CSV Controller is an npm package that allows users to upload CSV files and extract specific data. With this package, you can easily retrieve data from CSV files and perform further processing. Currently the first version supports extracting data from specific columns. Selected data is returned as an array of arrays, where each array represents a row in the CSV file.
Installation
To install the CSV Controller package, you can use npm or yarn:
npm install @nour-elgeziry/csv_controller
or
yarn add @nour-elgeziry/csv_controller
Usage
To use the CSV Controller package, you need to import the CSVController component and provide a callback function to handle the extracted data.
import CSVController from '@nour-elgeziry/csv_controller';
// Define the callback function to handle the extracted data
const handleData = (data) => {
// Process the data as needed
console.log('Extracted data:', data);
};
// Use the CSVController component and pass the callback function as the `onData` prop
const App = () => {
return (
<div>
<h1>CSV Controller</h1>
<CSVController onData={handleData} />
</div>
);
};
export default App;
In the example above, the handleData function is provided as the onData prop to the CSVController component. This function will be called with the extracted data as an argument whenever new data is available.
The extracted data will be returned as an array of arrays, where each inner array represents a row in the CSV file. Each value in the inner arrays will be a string.
Feel free to customize the example code and the handling of the extracted data according to your specific use case.