How to Iterate and Read Rows and Column. Openpyxl Tutorial #3

Поделиться
HTML-код
  • Опубликовано: 4 ноя 2024

Комментарии • 33

  • @ivoirecomics225
    @ivoirecomics225 10 месяцев назад +1

    I was so tired to search again and again and I've found you. Thank you for this video !

  • @MaveLight2030
    @MaveLight2030 2 года назад +2

    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!

  • @FlorinBaci
    @FlorinBaci 3 года назад +1

    Dude, just save my day, thanks

  • @mharshi
    @mharshi 17 дней назад

    Thanks!

  • @rebecaaras
    @rebecaaras 2 года назад

    Great video. Please keep doing them:)

  • @rohitkumarz
    @rohitkumarz 3 года назад +1

    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.

  • @litttlemooncream5049
    @litttlemooncream5049 3 года назад +1

    helps a lot!!

  • @ajayrajbhar2927
    @ajayrajbhar2927 2 года назад +1

    Usefull👨‍💻

  • @elevendarter112
    @elevendarter112 Год назад +1

    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..

    • @cesarlima88
      @cesarlima88 5 месяцев назад

      same! did u find the error?

  • @averybrooks2099
    @averybrooks2099 2 года назад +1

    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.

  • @thejasjeeth
    @thejasjeeth 2 года назад

    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'

    • @thejasjeeth
      @thejasjeeth 2 года назад

      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)

  • @JagjeetSingh-dc5sj
    @JagjeetSingh-dc5sj 2 года назад +1

    thnks brother

  • @girimpr
    @girimpr 3 года назад

    In inter rows how to delete rows with conditions ? Like if values are equal to xyz?

  • @LetMeGrindit
    @LetMeGrindit 2 года назад +1

    Thanks

  • @lazycool3611
    @lazycool3611 2 года назад

    how to copy cell value by itering rows of specific column using panda?

  • @thecriticalpoint
    @thecriticalpoint Год назад

    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?

    • @python-bits
      @python-bits  Год назад

      All videos are tied together but concepts don't overlap, so content discussed in tutorial#3 does not tie to other tutorial.

  • @rishijain8472
    @rishijain8472 Год назад

    what if we dont know the max row or max col

  • @sanjaysaroch249
    @sanjaysaroch249 Год назад

    can you please remove the Geo-location filter. I cant access your videos

  • @filzahhashmi5591
    @filzahhashmi5591 3 года назад

    How can i store one column in one variable and then second column in second variable?

    • @python-bits
      @python-bits  3 года назад +2

      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]

  • @mihirshah3151
    @mihirshah3151 3 года назад

    AttributeError: 'tuple' object has no attribute 'value' WHAT TO DO ?

    • @python-bits
      @python-bits  3 года назад +2

      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.

    • @mihirshah3151
      @mihirshah3151 3 года назад

      @@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.

    • @edwinfelix8392
      @edwinfelix8392 3 месяца назад

      @@python-bits worked for me too, thanks!

  • @faisaledits1
    @faisaledits1 Год назад

    ValueError: too many values to unpack (expected 2)

    • @python-bits
      @python-bits  Год назад

      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.

    • @A_Malefic
      @A_Malefic Месяц назад

      @@python-bits Sorry, but can you show this problem's solution?