Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import docx
- from bcompiler.utils import project_data_from_master
- def get_project_names(master_sheet):
- data = project_data_from_master(master_sheet)
- data = list(enumerate(data, start=1))
- output_list = []
- for x in data:
- output_list.append(x[1])
- return output_list
- def get_dictionary_data(project_title, master_sheet, cell_keys):
- data = project_data_from_master(master_sheet)
- project_data = data[project_title]
- output_list = []
- for item in project_data.items():
- if item[0] in cell_keys:
- output_list.append(item)
- return output_list
- def run(master_sheet):
- doc = docx.Document()
- summary_output_list = get_project_names(master_sheet)
- cells_we_want_to_capture = ['Brief project description (GMPP - brief descripton)',
- 'Project Scope']
- final_output_list = []
- for x in summary_output_list:
- final_output_list.append(x)
- final_output_list.append(get_dictionary_data(x, master_sheet, cells_we_want_to_capture))
- return final_output_list
- for x in final_output_list:
- doc.add_paragraph(x)
- doc.add_paragraph(x[0])
- doc.save('C:\\Users\\Standalone\\Documents\\bcompiler\\test.docx')
- run('C:\\Users\\Standalone\\Documents\\bcompiler\\target_master.xlsx')
Add Comment
Please, Sign In to add comment