I have been working with excel vba for some period of time related with automation. Now I am planning to upgrade to python. I did a little bit of research on how to implement automation using python. All I see people doing coding with PyCharm or Jupiter, to do an automation user has to have knowledge of python. What I want to know is how to create a tool or standalone application with python that does a repetitive task, calculation or report generation in excel. Where the end user doesn't have to worry about python or codes or learning new technology to accomplish the task.
I know this isn't technically and answer, and since I can't comment yet (too low rep), I'm going to point you to automate the boring stuff with python. I'm sure you can find your answer here plus some!
Here is my answer.
https://github.com/TaeYoon2/ExcelAutomation
This project is a sample excel automation program with python.
I used 'openpyxl' library.
welcome to stackoverflow. Here are a few resources that hopefully get you started on your journey to automating excel tasks with python then wrapping your project up for non-python users.
Python libraries that interface with excel (these are for you to write your excel automation projects)
openpyxl docs
pandas docs
pylightxl docs
more at http://www.python-excel.org/
Wrapping up your project for non-programmers
There are a few options here for your non-programmer users.
Have users run your python project on command line where you give them prompts to respond to for your automation (ie. input excel file name, automation task inputs etc). This is probably the simplest task on your end, but it does expect your users to know how to user command line.
Have users run your python project on command line but you create a graphical user interface (GUI) for them to ease the input field options. This requires some up front work on your end to wrap you input with a GUI of your choice; here are a few tkinter, pyqt.
Note that both of these options require your users to have python on their machine with the proper packages ready to go to execute your project. This can be a lot to ask for non-python users. Therefore finally you could use a packaging software like pyinstaller to wrap up your python project into an .exe
Hope that helps! Happy pythoning
Related
I have a Flask app using some Python libraries for NLP and audio processing that I want to turn into a Plugin for Audacity. Audacity accepts plugins in Nyquist, Perl, and C/C++. I'm guessing, because of the similarity between Perl and Python, that I should go that route. Audacity's docs are pretty sparse, and I haven't found any very useful tutorials, so I have a lot of questions. Forgive me if they're silly questions - this is really new territory for me. Any and all advice is welcome.
What are the steps necessary to turn that web app into a plugin?
Does creating a Perl plugin mean translating all the Python code into Perl, or just creating a Perl script that calls the Python code?
What does it mean that "scripting is not suitable for providing a service on a web server"?
Our Flask app relies on a large custom-trained model file for Mozilla's DeepSpeech - is it possible to handle very large files in a Plugin?
How do you test a plugin for a desktop app? Where do you see error logs?
Again, be gentle with me! I know these are probably silly questions, but I feel like my PM just dropped me in a foreign country with no map!
Number 1: for perl you need to build a Makefile.PL or use another module packager
Number 2: yes you will have to rewrite your code to perl. You probably could package it but you would have to assume that people installing your package have Python installed
Number 3: Hard to say, maybe they are worried about injecting code or possibly poor memory management from long running scripts
Number 4: You can ship large files, if you're duplicating and releasing other peoples code, it's maybe better to use their installer for it and decouple your code from it
Number 5: there are many ways to test it. You can (and should) decouple the UI from the business logic. The business logic cn be tested with standard unit testing. The UI with something like Selenium. You may also need integration tests to test end-to-end
Recently I've been developing Python code as a freelancer. I've mostly worked on social media bots, my usual way of delivering the code is as a Python script for people to run on their compilers. However, I've started to run into people that lack the technical knowledge of installing modules and running the code that way. How do I create a package like software and deliver it in a way that can be ready-to-run and users don't have to download anything extra? Thank you in advance for your feedback.
Check out py2exe. It is a wrapper that converts your script into an executable, so the user can run it without needing to install any python libraries.
Alternatives to py2exe are:
PyInstaller - the advantage of using this is that it lets you build executables in formats other than exe, if you want to make your program run on non-Windows platforms, for example.
cx_Freeze - this is also another cross-platform alternative.
One method would be (as stated in the previous answer) is to use exe converters, but that wouldn't be as effective if you target Mac and Linux users as well.
My solution is going to take you a little more time, but it will be worth it. Here goes:
Please learn Angular JS, or some other framework (I prefer Angular). Once you know that, you can easily develop a web app for your project, and add your Python to that.
The good news is, there are lots of tutorials for this, such as https://codehandbook.org/creating-a-web-app-using-angularjs-python-mongodb/ (also teaches you mongodb) Anyways, you can find other tutorials on your own.
You could of course, I guess, build it into a mobile app, but I think web app would be easier.
I am teaching a class soon and I want to have users try my platform without the need of installing Python in their computers and to run everything online. I have searched for platforms such as Skulpt, CodeMirror and Trinket and they seem ok for what I want to do. However, I want to develop a GUI for the users to input parameters since there are a lot of options and I don't want users with no Python experience to run the programs from the command line like I do and hide the Python code behind the GUI. I have learnt simplegui recently but I think the GUIs you can create are not visually pleasant and for me this is a big no. I also saw in another post that using Tkinker with a in-browser python implementation is not possible.
So, I would like to know what would be the best combination of in-browser Python implementation and GUI module to reach my goal please?
Thank you so much!
I guess Jupyter could meet your needs. Getting started here.
The Jupyter Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, machine learning and much more.
The Notebook has support for over 40 programming languages, including those popular in Data Science such as Python, R, Julia and Scala.
I'm looking to be able to create an executable with py2exe or something similar that takes information from an excel sheet and returns a word file.
Since my coworkers are technically challenged, I need to create an executable that will take the work out of it for them.
Two questions here:
I have to be able to import something into the python script that represents DataNitro. What module represents DataNitro?
Is this legal? I won't be using a DataNitro license on every machine this exe will run on, besides my own, so if it's even possible, is this a bit shady?
Thank you.
P.S. If I'm not able to do this I will probably have to use xlrd,xlwt,etc.
The best way to give non-technical users access to DataNitro is to copy the VBA interface: hook the script up to an Excel button and have users press that button to run it. (There's no difference between running a Python script with DataNitro and running VBA code from the user's point of view.)
Each person using the script would need a DataNitro license.
There's no way to make DataNitro work with py2exe, unfortunately.
Source: I'm one of the DataNitro developers.
I have written a program. I don't know if it is important how it is written but you can find it here: http://pastebin.com/Z3ZvVPV8 Basically, it asks you to assign values to variables and will perform calculations depending on what variables you chose, and prints the answer.
I would like to know how I can make the program run in a window other than cmd (I am using Windows Vista 32bit). I don't need much at all in terms of GUI, just a window that is a bit more user friendly/easier to look at when they are using the program.
EDIT: To those suggesting using IDLE, while that would work for me, if others want to use the program they would have to download it, so I was hoping for a way for that not to happen.
Python comes with a sort of default GUI package TkInter you can use it.
Also there is a lot of other GUI packages available.
The Python standard library offers a lot of ways to implemt simple (but also rather complex) GUIs. I'd like to point you at the documentation of TK (tool kit for graphical interfaces) http://docs.python.org/library/tk.html where you will find also some useful example of use.
Py2Exe is a viable option if you really don't need a gui. This will make it run and look like a command prompt, but it will be an .exe file. Here is a quick quote from thier page: "py2exe is a Python Distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation."
Another alternative is to get Portable Python. Here is a quote from thier webpage: "Portable Python is a Python® programming language preconfigured to run directly from any USB storage device, enabling you to have, at any time, a portable programming environment. Just download it, extract to your portable storage device or hard drive and in 10 minutes you are ready to create your next Python® application." After packaging the portable python and your .py or .pyc file then create a .bat file that runs the portable python "Python-Portable.exe" with the correct command line parameters for loading your script. Be sure to use relative paths in the batch file in case they are running it from a flash drive, or something other than the same location as you.
NOTE: This is really not a good way to do this as thier download page states: "Installed size: based on selected packages, between 49MB and 480MB". Also be sure to read the the current Python Software Foundation License, as that is what Portable Python is released under, and it may or may not be legal to package it in a closed source project. I haven't really looked at the license myself to be able to tell you. If you are releasing it as open source, then there would not be an issue though. As a quick side note, if you need that .bat file to be a .exe file then you can use a .bat to .exe converter battoexe.com is one. This is really going the long way about doing the whole thing, but it is an option.
Sources:
Working with Python on and off for 7 years now, a lot that using a portable version on a flash drive, and also dealing with Batch files much longer.