score:1
i am answering my own question. using file system apis does not work on client side javascript as it does not run on node. so first the excel content should be fetched in the form of blob and use that blob. following solution works for me.
import xlsx from "xlsx";
const targetcsvpath = window.location.origin + "/xrayconfig.xlsx";
const reader = new filereader();
reader.onload = function (e) {
const workbook = xlsx.read(e.target.result, { type: "binary" });
// your operations on workbook comes here
}
fetch(targetcsvpath)
.then((response) => response.blob())
.then((data) => {
reader.readasbinarystring(data);
})
.catch((err) => console.log(err);
Source: stackoverflow.com
Related Query
- Reading Excel file in client side JavaScript
- Reading excel file in Reactjs
- Javascript Vue or React storing sensitive information client side safety
- How can I import JavaScript file downloaded from `npm` or `yarn` to client (browser)?
- Reading excel file in react
- How do I rewrite on client side a svg file I fetched from the server?
- Executing JavaScript client written code on server side of an application
- Client side certificate javascript request
- React - Saving a file client side from Axios request
- How can I read the data in the excel file with reactjs or javascript using the path to the file
- Rails 5 Redux React Server Side Rendering gives client side JavaScript warning 'Replacing React-rendered children with a new...'
- Trouble with file upload using javascript swagger client and react
- How To Do JavaScript Object Oriented Programming client side The Right Way?
- File streamed from node and made into blob on javascript client is much larger and corrupted
- socket io on client side only runs after I save the file containing the connection
- How to get file from input tag in react client side app
- Import JavaScript file and call functions using webpack, ES6, ReactJS
- how to use webpack to load CDN or external vendor javascript lib in js file, not in html file
- In Flux architecture, how do you manage client side routing / url states?
- Generate single physical javascript file using create-react-app
- Can't access gatsby environment variables on the client side
- Calling Dispatch function from a blank javascript file
- Examples of client side auth in react
- Can I use webpack on the client side without nodejs server?
- You need to enable javascript to run this app response when try to access local json file in react
- Getting the current url on the client side in next.js
- JavaScript not able to rename file before upload
- Axios Excel file download using POST results in corrupted file
- React excel file download corrupt
- How to add external javascript file with reactjs
More Query from same tag
- React Table not loading from Network Request
- React: Persisting state in tabs
- Next.js show/hide divs on buttons
- Execution failed for task ':app:compileDebugJavaWithJavac'. > Could not find tools.jar
- Pass prop to every single page in Next.js with getInitialProps using Typescript
- Can't import Google Fonts with Styled Components and Next.js
- How to specify return type as a list of React components with Flow
- How to programmatically reset scroll in react-table
- Better approach to create react-redux layout header component
- Why function works without "this" binding?
- How to get values from object and assign them to consts
- How to use formValueSelector() of redux form to acces of the value of a button
- Passing Props With Input - React
- How to pass const to multiple components / Spliting React-Redux-Router files
- Cannot apply multi background color to material ui snackbar
- Yup /w Formik File Upload Validation
- getManyReference isn't fired using ra-data-json-server
- React js how to return div with async timeout
- How to authorise jwt token on client side PrivateRoute?
- css flex-box contains space for an extra inner element
- How to preserve state value after re-running setState
- Is it valid to increment a state object value inside setState(); without cloning the object?
- React component with Dagre-D3 not drawing correctly
- Get text from textbox react js
- How to set focus on a custom filter dialog in ag-grid react?
- React defaultProps not working as expected
- How to return multiple Menu.Items in one ternary expression
- Zero results found: GraphQL query on live deploy with WordPress API and Gatsby on Netlify
- In useEffect, do all variables get updated when an update is called?
- How to add dynamic basePath in NextJS