spinetoolbox.spine_io.importers.excel_reader

Contains ExcelConnector class and a help function.

author:
  1. Vennström (VTT)
date:

1.6.2019

Module Contents

spinetoolbox.spine_io.importers.excel_reader.select_excel_file(parent=None)[source]

Launches QFileDialog with .xlsx and friends filter

class spinetoolbox.spine_io.importers.excel_reader.ExcelConnector[source]

Bases: spinetoolbox.spine_io.io_api.SourceConnection

Template class to read data from another QThread.

DISPLAY_NAME = Excel[source]
OPTIONS[source]
SELECT_SOURCE_UI[source]
connect_to_source(self, source)[source]

saves filepath

Parameters:{str} -- filepath (source) –
disconnect(self)[source]

Disconnect from connected source.

get_tables(self)[source]

Method that should return Excel sheets as mappings and their options.

Returns:Sheets as mappings and options for each sheet or an empty dictionary if no workbook.
Return type:dict
Raises:Exception – If something goes wrong.
get_data_iterator(self, table, options, max_rows=-1)[source]

Return data read from data source table in table. If max_rows is specified only that number of rows.

get_mapped_data(self, tables_mappings, options, table_types, table_row_types, max_rows=-1)[source]

Overrides io_api method to check for some parameter value types.

spinetoolbox.spine_io.importers.excel_reader.create_mapping_from_sheet(worksheet)[source]

Checks if sheet is a valid spine excel template, if so creates a mapping object for each sheet.