How to Automate Excel Formulas using Python. Openpyxl Tutorial #9

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

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

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

    Thank you for knocking down barriers to python automation in excel. I've seen some other videos where a guy was doing all kinds of wacky stuff to address cells.
    I'm grateful that you do what you do.

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

    Thank you, Sir, you teach Best, Thank you, Sir, please make more videos on python excel, Thank you, Sir

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

    Great easy to follow video. Very helpful for something I am trying to automate with python and excel. Thank-you!

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

    Excellent boss

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

    nice explanation thank you

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

    Superb this is very helpful... can you please tell how to copy paste with formats?

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

    Great content man, love your work. Would it be possible to access some of the feature of excel like goal seek for example using openpyxl or any other python module?

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

    Hello. Great video
    I am getting type error for formula of subtracting two col values..how can I resolve?

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

    Thank you for this helpful tutorial.
    Is there a way I can get the result of the formula in python (as opposed to the formula itself ?)

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

    My excel has some formulas in it. When I read the excel values using openpyxl, it reads the formula instead of values. Please suggest a way to read values instead of formula.

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

      Did u find any solution 👀

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

      @@abhisheksinghrajput4022 Nope.. I changed my entire approach instead !!

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

      @@surendarsakthivel38 u can use Excel macro to copy paste the cell by value and run macro from python that would help

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

      You can apply data_only=true filter to exclude formula. Ex: openpyxl.load_workbook('sample.xlsx', data_only=True)

    • @ahmadmuhaimin2852
      @ahmadmuhaimin2852 9 дней назад

      ​@@surendarsakthivel38how is your approach then, i get the same problem?

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

    Truly Appreciated. It's really really Great. Sir, I've one question, Please let me know. I am working on Jupyter Notebook Only. So How do I perform the same thing on Jupyter?
    Please Please Let me know Sir.
    Thanks for your Support.

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

      Thanks! Jupyter is just a fancy version of python terminal. It allows you to execute chunk of code instead of whole file. Start writing line(s) of code and execute them; it should run as long as they are in order (i.e., make sure to call methods/variables after they're defined or imported).

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

    Sir how to create vlookup formula between 2 worksheets using openpyxl

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

      Will upload new video on this.

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

    How can i remove formula =SUM(A1:A10) from excel using python?

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

    Wow, so simple and crisp. Subscribed. 🎉
    How can we do this same thing using pandas?
    I wish I knew this earlier to clear the interview, I got rejected in.

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

    Great video. But i input formula to MS-Excel . because value after input to excel is "str" . Formula not active. can y help me !!

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

    Very good video. But when I run this I get error: AttributeError: 'tuple' object has no attribute 'Font' (if I make my headings of totals all bold) ie [A8:A9]

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

    Hi sir, I'm very grateful for your sharing, but I want to ask why should I use python instead of excel? The formula in excel is dynamic. If I insert a column between col A and col B after I wrote the formula, the excel formula still works, the python formula will not work (I think)

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

      Ideally, this kind of automation should be used for repetitive work. For example, if you have to merge two excel files on daily basis then automation is best option.

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

      As a python beginner, and long time Excel user, I find the code.py approach a better way of showing what happens inside the worksheet, both for colleagues and myself at later stage.
      If incorporated in a Jupyter notebook you can almost avoid Excel altogether for your reports, the learning curve to achieve it is not too steep

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

    Thannnqqqqqqqqqqqq✨

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

    How to print the average value to screen.. i.e .. wb[B12]

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

      You can do something like this:
      cell_values = []
      for row in ws['B1':'B12']:
      for row_val in row:
      cell_values.append(row_val.value)
      avrg = sum(cell_values)/len(cell_values)
      print(avrg)