How to Write/Update Data in Excel Using Python. Openpyxl Tutorial #4

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

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

  • @amandalow1065
    @amandalow1065 3 года назад +2

    Love your videos - clear transitions and explanations. Look forward to other Python videos!

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

    Super clear you saved my day fella ! Many thx

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

    Excellent work friend. You've managed to provide a lot of detail in a handful of small very direct videos.

  • @Sin-x89
    @Sin-x89 3 месяца назад

    hello
    Python Bits
    following the proposed exercise, if I had a list. of the same size as column c, but I would like to add my list example, my_list=['a','b','c','d','e','f','g','h', 'm'] in column d, as I introduce with the for loop method, if when I did it, it only copied the last element of the list, in this case m is copied in all rows from 2 to 9. and not like this all the elements in the list. greetings.

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

    Is it possible to update the cells dynamically using iter_row ? I have a for loop that iterates between a min_row and max_row. The problem is that when I print (row[0]), it correctly prints the value of the first cell in each row between the selected min and max. But i want to now use the same for loop with iter_row to dynamically update the value of row[0] in each row between the selected min and max. Thats where my code is failing. Any help will be much appreciated.

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

      You can re-assign value to same cell (ex. i.value = 'NEW_VALUE' ) within your loop and then add wb.save('BOOK.xlsx') as a last statement. If you don't add save command then changes will not be reflected in the excel sheet.

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

    Is it possible to make changes without closing excel file. Can we make excel file dynamic

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

    Is it possible to add vallue in two sheets at the same time?

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

      Yes. You need to get both worksheets (like wb1 and wb2), access cell in both sheets and assign values. You can add wb1 and wb2 under some kind of loop and update at the same time.

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

    Thank you very much😍

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

    Thank You sir

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

    nice bro

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

    Nice video. Thanks!

  • @MICHAEL-hi3xo
    @MICHAEL-hi3xo 2 года назад

    i cannot save in the same file name,it asks me to change the name and it works, but i want in the same file name

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

    Why when I run these:
    for i in range(2,10):
    b_col = ws.cell(row=i,column=2).value
    c_value = b_col*2
    ws.cell(row=i, column=3).value = c_value
    it shows me this kind of error: unsupported operand type(s) for *: 'NoneType' and 'int'

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

      One of your cell is returning None value. If you try putting None*2 in python console, you will see same error. Try adding if statement to eliminate None before multiplication.

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

    how do you read and write a merged cell?

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

    type error: unsupported operand types for * : 'None Type' and 'int' -----at line number 17 where we are doing the mathematical calculation
    solve this issue

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

      One of the cell in B column is blank, so when loop comes to blank cell, it saves None as a b_cell value. If you try to multiply anything with None/NoneType, it throws this error. To avoid this add a if condition there
      if b_col != None:
      c_value = b_col*2
      ws.cell(row=i, column=3).value = c_value

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

    I'm facing an attribute error cell is not in workbook

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

      Make sure openpxl function/property name you're trying to use is correct. This will most likely happens due to typo error in method names.

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

    ws.cell(row=i, column=6).value=f_col it's not same f_col=ws.cell(row=i, column=6).value
    ?? why

  • @ВалерийУсов-щ8е
    @ВалерийУсов-щ8е Год назад

    Mmmm.... Indian...
    Im in deal !)