your video were so concise and helpful. hope more people find it. Also maybe adding in more keyword like automation using openpyxl as mostly people would be using it for that. otherwise for most manipulation I see everyone using pandas or dask if the excel/csv is large.
This is strange. When I write this: for row in rows: print(row) for a, b in rows: print(a.value, b.value) It only prints the first loop and then in stops. If I comment the first loop, then the second loop prints the values correctly. Didn't expect that..
Anyone happen to know how to iterate through and find the first and last blank cell? I've tried empty quotes and quite a few other ways but everything I have found points to not being able to detect empty cells in a spreadsheet. If anyone out there knows, I would appreciate it. Thanks.
Thanks for Good info , Nice and crisp , how do we over come the error , in ur code Traceback (most recent call last): File "python_script.py", line 6, in rows =list(ws.rows) AttributeError: 'list' object has no attribute 'rows'
The code is simple import openpyxl wb = openpyxl.load_workbook("my_input.xlsx") ws = ['Sheet1'] rows =list(ws.rows) // the error is in this line print(rows)
I'm confused about the application of iterators with respect to reading and writing data. Is there something that ties Tutorial #3 and #4 together? Why would an iterator not be used?
You will need to unpack that tuple before you access value. If ‘a’ is returning tuple, then you should do 'a[0].value' which will give you value of first element in tuple.
@@python-bits Yeah actually i solved the problem, even if i am checking a single cell, the generator object returns a tuple with a single object in it. I thought for a singular cell it might return a single cell object instead of a tuple. Thanks man.
Make sure to provide correct number of variables while unpacking your tuple or list. I only have two columns so each iteration has two items inside tuple, which I am handling via a & b variables. Your tuple could be larger or smaller if you've more/less columns in your sheet. In sort, you need to provide a variable for each value in your tuple.
I was so tired to search again and again and I've found you. Thank you for this video !
Glad I could help!
This is one of the BEST channels / videos I've found for Python Openpyxl, hands down. Thank you so much! Will forward this to friends too!
Glad it was helpful!
Dude, just save my day, thanks
Thanks!
Great video. Please keep doing them:)
your video were so concise and helpful. hope more people find it. Also maybe adding in more keyword like automation using openpyxl as mostly people would be using it for that. otherwise for most manipulation I see everyone using pandas or dask if the excel/csv is large.
helps a lot!!
Usefull👨💻
Glad to hear that
This is strange. When I write this:
for row in rows:
print(row)
for a, b in rows:
print(a.value, b.value)
It only prints the first loop and then in stops. If I comment the first loop, then the second loop prints the values correctly. Didn't expect that..
same! did u find the error?
Anyone happen to know how to iterate through and find the first and last blank cell? I've tried empty quotes and quite a few other ways but everything I have found points to not being able to detect empty cells in a spreadsheet. If anyone out there knows, I would appreciate it. Thanks.
Thanks for Good info , Nice and crisp , how do we over come the error , in ur code
Traceback (most recent call last):
File "python_script.py", line 6, in
rows =list(ws.rows)
AttributeError: 'list' object has no attribute 'rows'
The code is simple
import openpyxl
wb = openpyxl.load_workbook("my_input.xlsx")
ws = ['Sheet1']
rows =list(ws.rows) // the error is in this line
print(rows)
thnks brother
In inter rows how to delete rows with conditions ? Like if values are equal to xyz?
Thanks
how to copy cell value by itering rows of specific column using panda?
I'm confused about the application of iterators with respect to reading and writing data. Is there something that ties Tutorial #3 and #4 together? Why would an iterator not be used?
All videos are tied together but concepts don't overlap, so content discussed in tutorial#3 does not tie to other tutorial.
what if we dont know the max row or max col
can you please remove the Geo-location filter. I cant access your videos
How can i store one column in one variable and then second column in second variable?
You can do something like this:
col_b = ws['B']
lst_b_values = [x.value for x in col_b]
col_c = ws['C']
lst_c_values = [x.value for x in col_c]
AttributeError: 'tuple' object has no attribute 'value' WHAT TO DO ?
You will need to unpack that tuple before you access value. If ‘a’ is returning tuple, then you should do 'a[0].value' which will give you value of first element in tuple.
@@python-bits Yeah actually i solved the problem, even if i am checking a single cell, the generator object returns a tuple with a single object in it. I thought for a singular cell it might return a single cell object instead of a tuple. Thanks man.
@@python-bits worked for me too, thanks!
ValueError: too many values to unpack (expected 2)
Make sure to provide correct number of variables while unpacking your tuple or list. I only have two columns so each iteration has two items inside tuple, which I am handling via a & b variables. Your tuple could be larger or smaller if you've more/less columns in your sheet. In sort, you need to provide a variable for each value in your tuple.
@@python-bits Sorry, but can you show this problem's solution?