Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use JS to output the contents of Excel Table in Vue

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Today, I would like to share with you how to use JS in Vue to output Excel table content related knowledge points, detailed content, clear logic, I believe that most people still know too much about this knowledge, so share this article for your reference, I hope you have something to learn after reading this article, let's take a look at it.

Question:

Use js in the vue project to get the data in the Excel table

Solution: step 1: download plug-in cnpm i xlsx step 2: create a new js file, write the method, and export import XLSX from 'xlsx'function get_header_row (sheet) {const headers = [] const range = XLSX.utils.decode_range (sheet ['! ref']) let C const R = range.s.r / * start in the first row * / for (C = range.s.c) C {const data = e.target.result const {results} = read (data 'array') if (results) {let arr = this.$CommUtils.deepClone (results.split ('\ n')) arr = arr.filter (item = > {return item}) this.keyWordData = arr console.log (arr)} },}

Arr is an array, each element is a string, separated by commas, if you want to get one of the points, you need to use split to cut into an array, and then create a new empty array to push the data you need.

These are all the contents of the article "how to use JS to output Excel table content in Vue". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report