Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need Help With a Script
#2
OK.... Update I've changed my script once again. Here is what I have now:

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
Reply


Messages In This Thread
Need Help With a Script - by SunWers - Jan-05-2021, 05:42 PM
RE: Need Help With a Script - by SunWers - Jan-05-2021, 05:49 PM
RE: Need Help With a Script - by buran - Jan-05-2021, 06:34 PM
RE: Need Help With a Script - by SunWers - Jan-05-2021, 08:56 PM
RE: Need Help With a Script - by buran - Jan-05-2021, 09:00 PM
RE: Need Help With a Script - by SunWers - Jan-05-2021, 09:43 PM
RE: Need Help With a Script - by SunWers - Jan-07-2021, 03:26 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020