mirror of https://github.com/jumpserver/jumpserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
379 B
15 lines
379 B
import pyexcel
|
|
from .base import BaseFileParser
|
|
|
|
|
|
class ExcelFileParser(BaseFileParser):
|
|
|
|
media_type = 'text/xlsx'
|
|
|
|
def generate_rows(self, stream_data):
|
|
workbook = pyexcel.get_book(file_type='xlsx', file_content=stream_data)
|
|
# 默认获取第一个工作表sheet
|
|
sheet = workbook.sheet_by_index(0)
|
|
rows = sheet.rows()
|
|
return rows
|