OK.... Update I've changed my script once again. Here is what I have now:
Note: Right now I'm adding a new sheet ('Results') to the Weekly-temp just to see if I can get it to import over. Eventually I want this data to go into the correct columns/rows of the Cutter A - Marker tab of the Weekly-temp.xlsx.
Thanks,
Veronica
import openpyxl wb1 = openpyxl.load_workbook(r'ImportFile1.xlsx') wb2 = openpyxl.load_workbook('Weekly-temp1.xlsx') ws1 = wb1['Import'] # Raw data from cutters ws2 = wb2['Cutter A - Marker Report'] # Report for Raw data to be imported ws3 = wb2.create_sheet(title='Results') for x in ws1['B2:B100']: for y in ws2['C4']: if ws1['B2:B100'] == ws2['C4']: ws3.write_row(row=8).value wb2.save('Weekly-temp1.xlsx')But when I run this file it gives me the following error
Error:runfile('C:/Users/vhubbard/Documents/Python Scripts/temp.py', wdir='C:/Users/vhubbard/Documents/Python Scripts')
Traceback (most recent call last):
File "C:\Users\vhubbard\Documents\Python Scripts\temp.py", line 24, in <module>
for y in ws2['C4']:
TypeError: 'Cell' object is not iterable
What would I be doing wrong? Note: Right now I'm adding a new sheet ('Results') to the Weekly-temp just to see if I can get it to import over. Eventually I want this data to go into the correct columns/rows of the Cutter A - Marker tab of the Weekly-temp.xlsx.
Thanks,
Veronica