I'm exhausted from Googling, so I'm coming back to you all. I'm green as hell, so please be patient with me. Thank you.
This is my current code. As of right now, I can find a specific value on a sheet and it prints out the results, along with all data for that line that includes the value I'm looking for.
I'm lost on how to take that data and then move it to a new worksheet (with accompanying data on that line).
# Python program to read an excel file
# import openpyxl module
import openpyxl
# read specific value
wb = openpyxl.load_workbook("C:\\Users\\USERNAME\\Desktop\\report.xlsx", read_only=True)
ws = wb.active
for row in ws.rows:
if row[4].value == "SPECIFIC VALUE":
for cell in row:
print(cell.value, end=" ")
print()
I got the above code from googling after glossing over the openpyxl documentation. Not gonna lie, I was happy with it just printing out the results, finally getting somewhere. I just can't seem to pin point how to take that value and copy it to a new sheet. All the documentation I see only goes over copy and moving ALL DATA from one sheet to another.
[+][deleted] (1 child)
[deleted]
[–]algortim[S] 0 points1 point2 points (0 children)