Run SQL queries in EXCEL (just like a normal Excel formula 🤯)

Поділитися
Вставка
  • Опубліковано 14 гру 2024

КОМЕНТАРІ • 146

  • @CodingIsFun
    @CodingIsFun  2 роки тому +17

    *Do you use SQL at your job?* 🤔

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

      I get the error: "Could not activate Python COM server, hr=-2147221164" 😣😣

    • @SaulEduardoo2
      @SaulEduardoo2 2 роки тому +1

      Hi Sven, I don't used, I don't even know how to program in SQL, but, use SQL will allow me to create database more ease to manipulate instead of having all the data in excel.

    • @channelbtv2903
      @channelbtv2903 Рік тому

      Thank you sir, do you have any tutorial using dynamic SQL instead of statik syntac SQL in excell?

    • @CodingIsFun
      @CodingIsFun  Рік тому

      @@channelbtv2903 nope

    • @Russels_Viper
      @Russels_Viper Рік тому

      Can this work with Oracle ?
      If yes, how do I go about doing it .

  • @plavali_znaem
    @plavali_znaem Рік тому +3

    The content of this channel is sooo underrated!! It’s not the first time I search for something very specific and end up here finding exactly this and more over my expectations!! 🎉🎉
    Weiter so, Sven! Danke sehr!

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Ah, you're making me blush! Thanks for the kind comment and happy to hear that you're enjoying the videos! ♥💪

  • @alanmusic3495
    @alanmusic3495 8 місяців тому +1

    This is just AMAZING! Is so much better than using python/pandas on the termina!!! I dont know why people arent talking about this.... I was searching for something like this and you were the only video I found. Keep it up!

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

      Happy to hear that it was useful; thank you for taking the time to leave a comment and for watching the video! Cheers, Sven ✌️

  • @TonySitterly
    @TonySitterly 7 місяців тому +2

    I love SQL and hate pivot tables - This is awesome!
    Thanks!

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

      Glad I could help! Cheers, Sven ✌️

  • @kuuuyajim
    @kuuuyajim 2 роки тому +5

    Wow! This is similar to the FILTER function but more advanced and easier to do if you know or prefer to use SQL for filtering. I can't think of a use case for my current job but it's a handy piece of knowledge to have. Thank you very much for sharing! 😉

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

      Thanks for watching. I totally agree. It is probably not what I need/use every day, but it is good to know and a great way to keep practising SQL.

    • @michaelomosebi6374
      @michaelomosebi6374 2 роки тому +1

      Thanks for this tip. I have a use case that will benefit from this FILTER function you just mentioned. Been on it for some days now.
      My PC keeps freezing once I input the sql function 😣😣

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

      Thank you for sharing! This is very useful in my daily work

  • @hamzakrack
    @hamzakrack 7 місяців тому +1

    Thanks man this is huge and it saves me a lot of time, but why excel doesn't have this included (or a similar feature) is beyond my understanding

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

      Glad I could help! Thanks for watching. Cheers, Sven ✌️

  • @mubafaw
    @mubafaw Рік тому

    Exactly what I was looking for. Excellent!!!!! Thanks😊👍

    • @CodingIsFun
      @CodingIsFun  Рік тому +1

      Happy to hear that it was useful; thank you for taking the time to leave a comment and for watching the video!

  • @samaritanx9609
    @samaritanx9609 2 роки тому +1

    Hi Sven, one more golden feather... shown great thing.. 💌

  • @andybecker5001
    @andybecker5001 2 роки тому +1

    This is great! No idea this could be done

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

      Glad you liked it. Thanks for watching and taking the time to leave a comment!

  • @gagansingh3481
    @gagansingh3481 2 місяці тому

    @coding is fun - But we have column which is blank rest others columns have value then how to filter the blank value with related columns with it .....

    • @CodingIsFun
      @CodingIsFun  2 місяці тому

      Thank you very much for watching the video and your comment. Your requirements are well noted. Yet, I receive many requests for creating individual solutions. As much as I want to help, I simply do not find the time in my daily schedule to develop & test all the different requests. I hope you can understand. Thank you! -Sven

  • @rianne465
    @rianne465 8 місяців тому

    Because of company policy, I have Sophos install and when I create the query, it shuts down Excel, because of 'malicious behavior'...

  • @bongrrjr
    @bongrrjr Рік тому

    Would you happen to have more SQL query sample? Thanks in advance.

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Thanks for watching. These are just some sample SQL queries. For your specific use case, you would need to write your own SQL queries.

  • @PirieHart
    @PirieHart Рік тому

    (1) How do you configure conditional formatting for output from the SQL() function?
    (2) Does the SQL() function support UPDATE or other SQL statements?
    Thank you for a very useful video!

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Thanks for watching! I'm not entirely certain about how or if it will work. Please feel free to give it a shot and see how it goes :)

  • @grev201
    @grev201 2 роки тому +1

    Is it possible to use variable declaration? Example, cell A1 has value as date
    declare @date_s date = A1
    select * from table a where a.DateDocument = @date_s

    • @CodingIsFun
      @CodingIsFun  2 роки тому +1

      Thank you for watching the video and for your excellent question. Right off the bat, I am not sure if that is possible. I would suggest trying it out yourself. There is not much setup/installation required, as shown in the video. Happy Coding!

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

    Extremely useful since I work a lot in Excel. Many thanks

    • @CodingIsFun
      @CodingIsFun  2 роки тому +1

      An absolute pleasure, very happy to hear that you found it useful!

  • @richievellalar3214
    @richievellalar3214 4 місяці тому

    you can use Filter F right ?

    • @CodingIsFun
      @CodingIsFun  4 місяці тому

      Thanks for watching. I have not tried that. Feel free to give it a try. Cheers, Sven ✌️

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

    Thank you very much for the excellent tutorial.

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

      Glad you liked it. Thanks for watching! 👍

  • @sergeysergey421
    @sergeysergey421 2 роки тому +1

    Very cool! I think Microsoft have to update Power Query tool for python and sql dialects. Pandas, sql have same language structure in my opinion.

  • @ddmittal420
    @ddmittal420 11 місяців тому

    Hi, thanks for the video. How do I convert datetime to date in the sql query of xlwings. The sql server functions like CONVERT don't seem to work. Thanks

    • @CodingIsFun
      @CodingIsFun  10 місяців тому

      Thank you for watching. XLWings uses SQLite under the hood, so you might want to try using strftime. Please note that I have not tested it. Happy coding! Cheers, Sven! ✌️

    • @ddmittal420
      @ddmittal420 10 місяців тому

      @@CodingIsFun strftime worked for me. Thanks so much!

  • @syazwanizulkhairi9972
    @syazwanizulkhairi9972 Рік тому

    Can we use update, insert, delete, create in this xlwings?

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Thanks for watching. I have not tried it out

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

    Great job ! Thanks for sharing !

    • @CodingIsFun
      @CodingIsFun  2 роки тому +1

      You're very welcome! Thank you for watching and for the comment!

  • @berbarmoumen1847
    @berbarmoumen1847 9 місяців тому

    ❤❤❤😂😅 Merci beaucoup pour votre aide. From Algeria

    • @CodingIsFun
      @CodingIsFun  9 місяців тому

      Thanks for watching! Cheers, Sven ✌️

  • @MAKEININDIA-q6m
    @MAKEININDIA-q6m Рік тому

    'xlwings' is not recognized as an internal or external command,
    operable program or batch file. what to to in this case, please help

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Hard to tell from a distance. My closest guess is that you are getting this issue because you are trying to import a module of a library which is not installed in your virtual environment. If you have run 'pip install xlwings' already, ensure to call your Python file from the same environment in which you installed the package. For example, in your IDE/text editor, you might have set a different Python environment for executing your script. Therefore, try to run your Python file also from the command prompt. If that does not work, try searching for the text of your error message on Google/StackOverflow. Happy Debugging!

  • @gamenotfound9376
    @gamenotfound9376 Рік тому

    Great video! Just a question, how did you empty the worksheet from cells and automatically format the query result? Thanks!

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Sorry, but I do not know what you mean

  • @sibisanjai741
    @sibisanjai741 3 місяці тому

    I am facing the issue please help me out
    but already installed ( pip install xlwings )
    C:\Users\sibis>xlwings addin install
    'xlwings' is not recognized as an internal or external command,
    operable program or batch file.
    C:\Users\sibis>

    • @CodingIsFun
      @CodingIsFun  3 місяці тому

      Thanks for watching. Please try the following:
      chatgpt.com/share/738b8329-f7eb-4fae-acdf-f51f3f08d924
      Cheers, Sven ✌️

    • @sibisanjai741
      @sibisanjai741 3 місяці тому

      @@CodingIsFun i already tried in chat gpt and online blogs also still facing the issue i raised the issue in github xlwings repo i will check

    • @CodingIsFun
      @CodingIsFun  3 місяці тому

      @@sibisanjai741 good luck 🤞

  • @MehakKatnoria-f1q
    @MehakKatnoria-f1q Рік тому

    Can i execute INSERT query the same way ?

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Feel free to give it a try

    • @mehakk_02
      @mehakk_02 Рік тому

      I did.. but it said “sqlite3 operational error near insert”. I tried multiple times☹️

    • @CodingIsFun
      @CodingIsFun  Рік тому

      @@mehakk_02 then I guess it's not possible :(

    • @mehakk_02
      @mehakk_02 Рік тому

      Oh!! Thanks anyways✌🏻

  • @MackieGamePlay
    @MackieGamePlay 10 місяців тому

    Do you have sample for UPDATE Function?

    • @CodingIsFun
      @CodingIsFun  10 місяців тому +1

      Nope, I have not tested it. Feel free to test it out yourself :)

    • @MackieGamePlay
      @MackieGamePlay 10 місяців тому

      @@CodingIsFun I encountered an error, it says 'NoneType' Object is not iterable
      My SQL is:
      UPDATE a
      SET JOB = 'SENIOR MANAGER'
      WHERE E_NO = 20;

  • @PKKY13
    @PKKY13 Рік тому

    Hey,
    I have a question with CONVERT metod, it's not working on EXCEL, is there a way to make it work?

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Thanks for watching. I am not sure about that. Sorry, that I cannot help!

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

    Hey there,
    God bless your efforts.
    I have only a general enquiry as a new sql learner.
    Suppose i created one table on sql management studio for data entry purpose...
    How can i compile this sql table into a windows application? In what compiler should i placed it?
    The reason i am asking that i would like to discover how an sql application is finally presented as an application...
    THanks for taking care of this

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

      Thank you for watching the video and for your question. Unfortunately, I do not know how to implement that right off the bat. I would also need to search the internet for a solution. Sorry that I cannot help!

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

    File not found: xlwings64-0.33.3.dll
    I'm getting this error when I run the sql query in the excel sheet. Could you please help me?

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

      Here you are: docs.xlwings.org/en/stable/troubleshooting.html

  • @adbarlev
    @adbarlev 10 місяців тому

    When filling the function arguments, I get Formula result = "Could not load xlwings64-0.30.13.dll from either of the following folders: ... any suggestions?

    • @CodingIsFun
      @CodingIsFun  10 місяців тому +1

      Thanks for watching. Please have a look here: docs.xlwings.org/en/stable/troubleshooting.html
      I hope it helps! Cheers, Sven ✌️

  • @kushagramishra7505
    @kushagramishra7505 Рік тому

    How you have assigned "a" to the table ? Can we assign different name to the table if yes then how?

    • @CodingIsFun
      @CodingIsFun  Рік тому

      I have not assigned an Excel table, but in the formula the first table is referred to "a", the second one to "b" and so on. To my knowledge, you cannot change the names.

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

    How to use each table separately ? Like to fetch data from table 2 i.e b we have to use a , is it possible just to fetch data from b or c ?

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

      Thanks for watching. I would suggest to download the sample file from the description. Afterwards, you can play around with your SQL queries and see if you run into any issues. Thanks!

  • @GurinderSingh-mh1ln
    @GurinderSingh-mh1ln Рік тому

    Hi please helo I m getting an error - File not found: xlwings64-0.11.8.dll

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Did you install xlwings and the add-in?

  • @nikhilwaghalkar1271
    @nikhilwaghalkar1271 Рік тому

    Getting error for second command xlwings is not recognised as an internal or external command.

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Did you install xlwings?

    • @nikhilwaghalkar1271
      @nikhilwaghalkar1271 Рік тому

      @@CodingIsFun yes

    • @CodingIsFun
      @CodingIsFun  Рік тому

      @@nikhilwaghalkar1271 what have you tried to troubleshoot?

    • @nikhilwaghalkar1271
      @nikhilwaghalkar1271 Рік тому

      I reinstall xlwings with "pip install xlwings" but it is already present and then tried to run xlwings addin install but unfortunately getting same error xlwings not found as internal or external command.

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

    This so much fun. Will definitely use it. 💯

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

    Hi. I got this error message "Python process exited before it was possible to create the interface object..... Working Dir: ." Maybe there is a place where to specify a connection string for the SQL server database?

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

      Hard to tell from a distance. I assume this might be due to your Python Path settings: github.com/ericremoreynolds/excelpython/issues/52

  • @gamenotfound9376
    @gamenotfound9376 Рік тому

    Problem: This add-in makes every resulting cell an Array. How can I convert the result into normal numbers/letters? I can't copy the results.

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Thank you for watching the video and for your question. Unfortunately, I do not know how to implement that right off the bat. I would also need to search the internet for a solution. Sorry that I cannot help!

  • @samuely1-v3z
    @samuely1-v3z Рік тому

    How can i write code more than 255 characters??

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Can you explain what you mean?

    • @samuely1-v3z
      @samuely1-v3z Рік тому

      Have you tried to run a bit mote complex code ? It is easily exceed char 255 which is the limited of a cell, can you solve it ?

    • @CodingIsFun
      @CodingIsFun  Рік тому

      @@samuely1-v3z Yes. Excel cells can have chars > 255, see example: www.screencast.com/t/fflBEuiMrW

  • @sheikhraisulislam4483
    @sheikhraisulislam4483 3 місяці тому

    really intriguing

  • @HeartistMurali
    @HeartistMurali 3 місяці тому

    The command 'xlwings addin install' is not working

    • @CodingIsFun
      @CodingIsFun  3 місяці тому

      What does "not working" mean?

    • @HeartistMurali
      @HeartistMurali 3 місяці тому

      It throwing up the message "'xlwings' is not recognized as an internal or external command,
      operable program or batch file."

    • @CodingIsFun
      @CodingIsFun  3 місяці тому

      @@HeartistMurali did you install it?

  • @mikaelapurugganan8006
    @mikaelapurugganan8006 Рік тому

    One question. I was trying to get the yearly sales (I've been working on something). It says OperationalError: no such function: YEAR. Can someone please help me?

    • @CodingIsFun
      @CodingIsFun  Рік тому +1

      Thanks for watching. Under the hood, xlwings utilizes SQLite. SQLite does not have a "YEAR" function, however you could try something like this:
      SELECT strftime('%Y', date_column) AS year FROM your_table;
      Good luck!

    • @mikaelaq.purugganan4367
      @mikaelaq.purugganan4367 Рік тому

      @@CodingIsFun Thank you so much! You're a life savior.

  • @jawadbari9481
    @jawadbari9481 Рік тому

    Hi, thank you so much, loved this, however im facing an issue my quries are working well, but when i try to find result by giving date parameter in my query its giving me blank result, for example my coloumn A of table having date in date formate "25-Jun-20" but how to write in query the date format so i can get the result of this date im tryping this in my where clause (where "Bill Date" = "20200625" but result is blank please help me in this

    • @CodingIsFun
      @CodingIsFun  Рік тому +1

      Thank you for watching the video and for your question. Unfortunately, I do not know how to implement that right off the bat. I would also need to search the internet for a solution. Sorry that I cannot help!

    • @jawadbari9481
      @jawadbari9481 Рік тому

      @@CodingIsFun I got the solution, although it costed me alot of time :P

    • @CodingIsFun
      @CodingIsFun  Рік тому

      @@jawadbari9481 feel free to share it here :)

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

    I was on one of ur previous videos about dataframes to excel in python I have files that need to be extracted that were created with pandas etc I dont code but I need the data from these files anyway u could help?

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

      Thank you for watching the video. Kindly understand that I receive many requests for individual solutions or modifications. That said, you might want to join our Discord server (pythonandvba.com/discord ) and post your question there. Thanks for your understanding. Happy Coding!

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

      @@CodingIsFun I posted thank you hope its possible

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

    I keep getting error "pip is not recognized"

    • @CodingIsFun
      @CodingIsFun  2 роки тому +1

      Have you installed Python and pip?

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

      @@CodingIsFun worked fine today. Not sure what happened the first 8 times. Thankyou

  • @asifnaeem7872
    @asifnaeem7872 Рік тому

    not working on large data set

    • @CodingIsFun
      @CodingIsFun  Рік тому

      How large is your dataset?

    • @asifnaeem7872
      @asifnaeem7872 Рік тому

      @@CodingIsFun say 100 thousand record set

    • @CodingIsFun
      @CodingIsFun  Рік тому

      @@asifnaeem7872 interesting. I have only tested it with a smaller dataset. Do you get an error message?

    • @asifnaeem7872
      @asifnaeem7872 Рік тому

      @@CodingIsFun yes. error like
      #value

  • @andfanilo
    @andfanilo 2 роки тому +1

    Well I can again tell my students that learning SQL will get them anywhere, even using Excel 😃

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

    Why does Joseph Slatter write a book untitled "Subscribe" ? 😆😆😆 just jokin, thanks a lot for your amazing work

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

      haha 😅 Thanks for watching and your comment! :)

  • @iDea16388-c
    @iDea16388-c 2 роки тому

    Thank you

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

      Glad you liked it. Thanks for watching.

  • @physicsmostafa1774
    @physicsmostafa1774 Рік тому

    SQL is much clear and well documented than Microsoft DAX

    • @CodingIsFun
      @CodingIsFun  Рік тому

      Thank you for watching the video and taking the time to leave a comment! 👍

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

    Only windows! 😭I’m macOS

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

      Thanks for watching anyways! Cheers, Sven ✌️

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

    pip isn't a recognised command

    • @CodingIsFun
      @CodingIsFun  2 роки тому +1

      Ensure that you have Python installed, as mentioned in the video

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

      @@CodingIsFun Thank you, sorry I jumped the gun and should have listened a little more before trying :)

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

    Thanx

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

      You're very welcome! Thank you for watching and for the comment!

  • @FelipeCampelo0
    @FelipeCampelo0 10 місяців тому

    Come on ! I need a solution so I can check my queries on any device, not only windows.

    • @CodingIsFun
      @CodingIsFun  10 місяців тому

      Yes, unfortunately, it is only available for Windows. Nonetheless, thank you for watching. Cheers, Sven ✌️

  • @wiseguy7224
    @wiseguy7224 5 місяців тому

    Du solltest an Deinen Akzent arbeiten. ;-)

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

    Thank you this fantastic trick. however, after intalling xlwings and xlwings addin, I am still getting an error. "ImportError: DLL load failed while importing _sqlite3: The specified module could not be found.
    from _sqlite3 import *
    File "C:\Users\Dheeraj.Jain\Anaconda3\lib\sqlite3\dbapi2.py", line 27, in
    from sqlite3.dbapi2 import *
    File "C:\Users\Dheeraj.Jain\Anaconda3\lib\sqlite3\__init__.py", line 23, in
    import sqlite3
    File "C:\Users\Dheeraj.Jain\Anaconda3\lib\site-packages\xlwings\ext\sql.py", line 2, in
    from .sql import sql, sql_dynamic
    File "C:\Users\Dheeraj.Jain\Anaconda3\lib\site-packages\xlwings\ext\__init__.py", line 1, in
    File "", line 219, in _call_with_frames_removed
    File "", line 783, in exec_module
    File "", line 671, in _load_unlocked
    File "", line 975, in _find_and_load_unlocked
    File "", line 991, in _find_and_load
    File "", line 1014, in _gcd_import
    return _bootstrap._gcd_import(name[level:], package, level)
    File "C:\Users\Dheeraj.Jain\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
    module = import_module(module_name)

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

      Thanks. Have a look here: docs.xlwings.org/en/stable/troubleshooting.html

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

    I am getting a File not found: xlwings64-0.29.1.dll error. plz help

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

      Have a look here: docs.xlwings.org/en/0.11.6/troubleshooting.html#:~:text=dll%20and%20xlwings64.,pip%20or%20conda%20%2C%20see%20Installation.

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

      @@CodingIsFun I have tried all this...but worth mentioning I am trying this in my Mac...shall this work in Mac?