mardi 14 juin 2016

Export a Data Structure to workbook Python


I am trying flatten a time-sheet form to a usable data structure.I have collected the information from an excel file and created a dictionary with the data I would like to export. I would like to exported the data structure to the first row of the destination workbook. Any help would be greatly appreciated. This is what I have so far.

import openpyxl

wb = openpyxl.load_workbook('Source_workbook.xlsx')
sheet = wb.get_sheet_by_name('Title')

Week = sheet.cell(row=1, column=1).value
Date = sheet.cell(row=2, column=1).value
Name = sheet.cell(row=4, column=2).value
Title = sheet.cell(row=5, column=2).value
Site = sheet.cell(row=6, column=2).value
LocID = sheet.cell(row=7, column=2).value

TimeSheet = {'Week': Week, 'Date': Date, 'Name': Name, 'Title': Title, 'Site': Site, 'LocID': LocID}

#export TimeSheet{} to Destination_workbook.xlsx

Aucun commentaire:

Enregistrer un commentaire