Automate Excel with Python and xlwings Part 1: Install xlwings and the basic

Поділитися
Вставка
  • Опубліковано 18 січ 2025

КОМЕНТАРІ • 63

  • @donghyunkim4671
    @donghyunkim4671 5 років тому +7

    a great tutorial. More people should watch this.

  • @kenrosenberg8835
    @kenrosenberg8835 5 років тому +3

    That makes my work very easy, thank you Jie

  • @nickwu5317
    @nickwu5317 5 років тому +3

    Jie 杰, great package intro series, it will be awesome to do some automation projects like automate sending email from outlook. Thank you 3000!

  • @MrSoumyabrata
    @MrSoumyabrata 5 років тому +2

    Thank you for sharing the information. It is helpful.

  • @manndipp
    @manndipp 2 роки тому

    thank you so much, it cleared so many doubts reagrding xlwings

  • @TheHoangdigan
    @TheHoangdigan 3 роки тому

    Thanks you Jie Jenn very much. Great Video

    • @jiejenn
      @jiejenn  3 роки тому

      Glad my video helped.

  • @davidepolizzi
    @davidepolizzi 4 роки тому +1

    Nice job. Can I ask you the name of the package you suggest at min 2:06 for developers who come from a VBA background? Thanks

  • @juanpablorestrepol2152
    @juanpablorestrepol2152 5 років тому +2

    Thank you very much!
    xlwings is very useful

  • @letmedie4you
    @letmedie4you Місяць тому

    Can you tell how did you set vscode to suggest intellisense on xlwings ? I don't get suggestions from editor

  • @noeldoller2958
    @noeldoller2958 3 роки тому

    Hi Jie Jenn. This is great tutorial introduction for python xlwings. Appreciate if you can create more excel automation project please so that I can have an example to follow: I have a project as below:
    I need to copy and paste to ranges of cells value from different excel workbook to master workbook. This is on weekly updating for week 39
    1) WB_Source_1: sheet name "raw" column B range B2:B28 copy and paste to WB_Master: sheet name 2G CSSR Column AN range AN2:AN28
    2) WB_Source_1: sheet name "raw" column C range C2:C28 copy and paste to WB_Master: sheet name 2G CDR Column AN range AN2:AN28
    3) WB_Source_1: sheet name "raw" column F range F2:F28 copy and paste to WB_Master: sheet name 3G CSSR Column AN range AN2:AN28
    4) WB_Source_1: sheet name "raw" column G range G2:G28 copy and paste to WB_Master: sheet name 3G CDR Column AN range AN2:AN28
    5) WB_Source_1: sheet name "PSR" column C range C17:C57 copy and paste to WB_Master: sheet name 2G PSR Column AN range AN2:AN28
    6) WB_Source_2: sheet name "Weekly FDD" column D range D5:D26 copy and paste to WB_Master: sheet name FDD Accessability Column AM range AM2:AM28
    7) WB_Source_2: sheet name "Weekly TDD" column F range F5:D26 copy and paste to WB_Master: sheet name TDD Accessability Column AM range AM2:AM28
    8) WB_Source_2: sheet name "Weekly TDD" column F range F5:D26 copy and paste to WB_Master: sheet name TDD Accessability Column AM range AM2:AM28
    9) WB_Source_3: sheet name "Weekly" column D range D6:D25 copy and paste to WB_Master: sheet name VoLTE Access Column AM range AM2:AM28
    10) WB_Source_3: sheet name "Weekly" column D range D6:D25 copy and paste to WB_Master: sheet name VoLTE Retain Column AM range AM2:AM25
    Every weekly same source to be copy and paste to the same Master file but on the succeeding weekly 40 column AN 2:AN25
    and soon.....
    Appreciate to please create an python program on this using xl wings or openpyxl.
    This will help a lot in automating my weekly tedious task

  • @WaqasSarwar93
    @WaqasSarwar93 4 роки тому +1

    How are you getting the syntex recommendations

  • @guillermoguijarrorodriguez252
    @guillermoguijarrorodriguez252 5 років тому +2

    Hello, Great video, What is the IDE that you are using? it looks really useful

    • @jiejenn
      @jiejenn  5 років тому +1

      Thanks. I am using Visual Studio Code (Free editor) by Microsoft. I have a video showing how to install the software
      ua-cam.com/video/T0O07hELcJc/v-deo.html

    • @guillermoguijarrorodriguez252
      @guillermoguijarrorodriguez252 5 років тому

      Right on! thank you for the answer ^^

  • @michaellu4103
    @michaellu4103 2 роки тому

    Is it possible to not open the workbook with wb.Book somehow?

  • @TheKollaesch
    @TheKollaesch 5 років тому +1

    Hi. Thanks for sharing this video.
    I‘m curious: How did you set up VS Code to run the code line by line directly into the python interpreter?
    And with which shortcut did you start the program to run?
    That‘s unfortunately not shown in the video.
    Thanks in advance.

    • @jiejenn
      @jiejenn  5 років тому +4

      By default, you can execute a line (or multiple lines) of code by selecting the lines, hold the Shift key then press Enter.

  • @李宇航-m6p
    @李宇航-m6p 5 років тому

    Hi, at 17:30 , what's the shotcuts made the range autofilled?

    • @jiejenn
      @jiejenn  5 років тому

      Highlight your range with the item you want to autofill, then use shortcut CTRL + D to perform autofill.

    • @李宇航-m6p
      @李宇航-m6p 5 років тому

      Jie Jenn You rocked me!

    • @jiejenn
      @jiejenn  5 років тому

      Glad it worked.

  • @punurimt
    @punurimt 3 роки тому

    How to read a file using xlwings having some blank rows. After reading the excel using xlwings, only the data that exists before the blank row is displayed as output. The data that exists after the blank row is not displayed at all. Could you please help on that.

  • @shalajparekh
    @shalajparekh 3 роки тому

    Is there a way to read cell values, without opening the Excel App?
    I dont want an excel app window to open and still read data

    • @CodingIsFun
      @CodingIsFun 3 роки тому

      xlwings is built on top of the win32com API. Every time you access a workbook, an Excel App (instance) will be created. You can set the visibility to 'false' to now show the open workbook. Yet, if you want to read cell values without creating the Excel App, I recommend using 'openpyxl'. Hope this helps.

  • @casju
    @casju 3 роки тому

    Any help on the "The object invoked has disconnected from its clients2" error? Thanks!

  • @DewanshiRamani
    @DewanshiRamani 7 місяців тому

    Hello, how to use xlwings server in wsl system step by step instraction

  • @dodgewagen
    @dodgewagen 3 роки тому

    Thanks, Jie. Very useful! I have one question.
    In your opinion, which library is more "convenient, or "mature", or "powerful": xlwings OR openpyxl?
    Thanks again for your advise.

    • @jiejenn
      @jiejenn  3 роки тому +1

      xlwings is based on the pywin32 library and openpxl relies on access the underlying XML files, two completely different approaches to manipulate Excel files. For Mac users, I would recommend openpyxl or xlsxwriter. For Windows users, I would recommend pywin32 for experienced developers and xlwin for inexperienced.

  • @learnsalot5927
    @learnsalot5927 4 роки тому

    Im new to python and am wondering which environment you are using. Is there a way to get Jupiter notebooks to provide a formula list as you type?

    • @jiejenn
      @jiejenn  4 роки тому

      I'm using Visual Studio Code as my editor. Have never used Jupyter before, not sure I can answer your questions.

  • @DipolRoy
    @DipolRoy 4 роки тому

    How are you running the python script while your Excel is open? I always get a Permission error.

  • @j.active911
    @j.active911 5 років тому

    which python are u using im running 3 and when i set the tab1,tab2,tab3, etc and try to enter the hello there into range not working comes back error?

    • @jiejenn
      @jiejenn  5 років тому

      I'm using Python 3.7. If you're getting the range is invalid error, check if you have any typos in your code.

    • @j.active911
      @j.active911 5 років тому

      @@jiejenn thanks man I figured it out it was the tab1 mine has to be sheet1 ty

  • @mrshubh101
    @mrshubh101 4 роки тому

    Any way we can save the file, without it opening in the end? I mean is there a way?

    • @jiejenn
      @jiejenn  4 роки тому

      Not sure if I understand your question.

  • @nhaninh5046
    @nhaninh5046 4 роки тому

    Hi Jie, how can I open file with a password protected .xlsx file?

    • @jiejenn
      @jiejenn  4 роки тому +2

      From their documentation, there is a password parameter when you reference the open method, but seems to be broken. I would recommend use win32com (pywin32) instead of xlwings since xlwings is based on win32com.
      Anyway, using xlwings, and to open a worokbook with a password,
      wb = xw.books.open(fullname='test.xlsx', password='abcd')

    • @nhaninh5046
      @nhaninh5046 4 роки тому

      @@jiejenn Thanks Jie, I tried wb = xw.books.open(fullname='test.xlsx', password='abcd')
      but found argument password unexpected error. I'm going to try pywin32 to open file now, because my work related excel much, so I be dependent on xlwings

    • @jiejenn
      @jiejenn  4 роки тому

      @@nhaninh5046 if you work with Excel a lot, I would recommend VBA instead of Python. Use Python if you need to integrate with 3rd party APIs or doing more complex analytics tasks.

    • @nhaninh5046
      @nhaninh5046 4 роки тому

      @@jiejenn Yes Jie, I worked with python parallelly VBA, my work require interacting with 3rd party APIs also

    • @jiejenn
      @jiejenn  4 роки тому +1

      @@nhaninh5046 if that's the case, to open a password protected Excel File,
      import os
      import win32com.client as win32
      xlApp = win32.GetActiveObject('Excel.Application')
      xlApp.visible = True
      wb = xlApp.Workbooks.open(os.path.join(os.getcwd(), 'test.xlsx'), None, None, None, 'abcd')

  • @patrick2041
    @patrick2041 2 роки тому

    Excelente!!

  • @sergiod1981
    @sergiod1981 2 роки тому

    I need some help. If someone can help me.
    I run a python script ,after some minutes Excel crashed with this error "we are sorry, but excel has run into an error that is preventing it from working correctly., Excel will need to be closed as a result. Would you like to repair now?"
    I have python 3,9 and I reinstalled office python and the libraries.
    I don't know where I can find information to resolve it?

  • @diamart9178
    @diamart9178 5 років тому

    Hello,
    Could you help me please.
    I did follow the same steps but i've an error when i try to to run this code : C:\Users\achraf\Downloads\Nouveau dossier\xlwings>pip install xlwings
    Could you plz put the folder with the xlwings script in the beginning ?

    • @jiejenn
      @jiejenn  5 років тому

      What does the error message say?

    • @diamart9178
      @diamart9178 5 років тому

      @@jiejenn He can't find the pattern, could you please send me the folder with the script
      I really appreciate your help

    • @diamart9178
      @diamart9178 5 років тому

      @@jiejenn He cannot find xlwings
      Could you please upload a file with all the instructions, scripts, documents....
      I really appreciate your help

    • @jiejenn
      @jiejenn  5 років тому

      Unfortunately, I have a full-time job, so not sure if I will have time to put together a documentation. Looks like your issue is outside my knowledge, your best bet is probably ask on StackOverflow or Goggling the issue.

    • @diamart9178
      @diamart9178 5 років тому

      @@jiejenn Is there any requirements before i can follow your tutorial ?
      Like what i need to have in my computer ?
      Best regards

  • @vishalsuryavanshi7548
    @vishalsuryavanshi7548 5 років тому

    How to write pandas dataframe into excel of type xlsb.

  • @NewYears1978
    @NewYears1978 2 роки тому

    Ugh I wish someone would show how to install and use Python...no guides show it..and I have never used it.