-
Notifications
You must be signed in to change notification settings - Fork 0
Importing data from excel files
Stoyfan edited this page Oct 5, 2019
·
3 revisions
This program will only import files with the file extension: .xlsx . This is achieved by using the openpyxl library. The class responsible for excel file importing is called DataFromFile.
You use the get_data method from the DataFromFile class to get the data which is held in a multidimetional dictionary organised by variable marker and type. (e.g data['y']['ERROR'] would return the error bar values for the y variable).
When you run the program, it will ask you to input the filename (without the file extension). If you do not follow the rules and structure below then the program will crash so be warned.
Each excel file must follow these rules, otherwise the program will crash:
- The 'table' must start from cell A0
- Each variable has its own cell.
- Error bar values and data values have to be in seperate columns.
- The columns do not need to be in a specific order.
- Each column must have the same amount cells.
- It must follow a defined structure.
Each column must have this structure:
- Variable marker (if it is a y variable then its just "y", otherwise it is xn where n is an integer)
- Type (This is either "DATA" or "ERROR").
- Name (Name of variable)
- Unit (Units of variable)
- Data (Which will be in cells below row 4)