diff --git a/operators/spreadsheet.py b/operators/spreadsheet.py index 243db79..a9fcfd7 100644 --- a/operators/spreadsheet.py +++ b/operators/spreadsheet.py @@ -133,7 +133,7 @@ class VSETB_OT_spreadsheet_from_file(Operator): from openpyxl import Workbook - workbook = openpyxl.load_workbook(filepath, read_only=True) + workbook = openpyxl.load_workbook(filepath, read_only=True, data_only=True) sheet = workbook.active rows = [(c.value or '') for r in sheet.rows for c in r] @@ -142,7 +142,7 @@ class VSETB_OT_spreadsheet_from_file(Operator): self.report({'ERROR'}, f'File extension {filepath.suffix} should be in [.csv, .xlsx]') return {'CANCELLED'} - rows = [r for r in rows if any(r)] + rows = [[(c.value or '') for c in r] for r in sheet.rows] cell_types = project.get_cell_types() for cell_name in rows[0]: @@ -526,7 +526,10 @@ class VSETB_OT_export_spreadsheet(Operator): rows = [] # Header - rows.append([cell.export_name for cell in cells]) + if spreadsheet.use_custom_cells: + rows.append([cell.export_name for cell in cells]) + else: + rows.append([cell.name for cell in cells]) separator = spreadsheet.separator.replace('\\n', '\n').replace('\\t', '\t').replace('\\r', '\r') delimiter = spreadsheet.delimiter.replace('\\n', '\n').replace('\\t', '\t').replace('\\r', '\r')