Python & Excel Data Collection Forms – Five Minute Python Scripts
[ad_1]
Upgrade your data collection forms with Python. We’ll cover how to create a basic data collection form and save the data entered back to an excel spreadsheet.
We’ll use tkinter and pandas to do this.
Let me know if you have questions, comments, or recommendations for the next video! Until next time.
Kite helps fund the channel, thanks for checking them out and supporting me —
⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing. https://www.kite.com/get-kite/?utm_medium=referral&utm_source=youtube&utm_campaign=derricksherrill&utm_content=description-only
THANKS SO MUCH FOR ALL THE SUPPORT!! (1,050+ SUBSCRIBERS!) Honestly speechless – Thank you everyone. Your support means so much.
The link to the GitHub code used in this tutorial:
https://github.com/Derrick-Sherrill/DerrickSherrill.com/blob/master/Python_Data_Form.py
The image used on the end screen of this video:
https://pixabay.com/photos/pug-dog-pet-animal-puppy-cute-801826/
*****************************************************************
I’ll start posting the full code in the description as well now too. (Let me know if you think this is a good change?)
Full Script from this video:
from tkinter import *
import pandas as pd
def submit_fields():
path = ‘excel.xlsx’
df1 = pd.read_excel(path)
SeriesA = df1[‘Operator’]
SeriesB = df1[‘Number’]
A = pd.Series(entry1.get())
B = pd.Series(entry2.get())
SeriesA = SeriesA.append(A)
SeriesB = SeriesB.append(B)
df2 = pd.DataFrame({“Operator”:SeriesA, “Number”:SeriesB})
df2.to_excel(path, index=False)
entry1.delete(0, END)
entry2.delete(0, END)
master = Tk()
Label(master, text=”Operator”).grid(row=0)
Label(master, text=”Number”).grid(row=1)
entry1 = Entry(master)
entry2 = Entry(master)
entry1.grid(row=0, column=1)
entry2.grid(row=1, column=1)
Button(master, text=’Quit’, command=master.quit).grid(row=3,column=0, pady=4)
Button(master, text=’Submit’, command=submit_fields).grid(row=3,column=1, pady=4)
mainloop()
*****************************************************************
Code from this tutorial and all my others can be found on my GitHub:
https://github.com/Derrick-Sherrill/DerrickSherrill.com
Check out my website:
https://www.derricksherrill.com/
If you liked the video – please hit the like button. It means more than you know. Thanks for watching!!
Useful Links
—————————————————————————————————————–
Python Download:
https://www.python.org/downloads/
(Remember Python 3 is the future!)
I use Atom Text Editor for all my tutorials
Atom Text Editor:
https://atom.io/
Packages I often use in Python tutorials:
-Pandas
https://pandas.pydata.org/pandas-docs/stable/
-Numpy
https://www.numpy.org/
-xlrd
https://xlrd.readthedocs.io/en/latest/
-TensorFlow
https://www.tensorflow.org/api_docs/python
-Matplotlib
https://matplotlib.org/
-Django Framework
https://www.djangoproject.com/
-Beautiful Soup
https://www.crummy.com/software/BeautifulSoup/
(Install through Terminal $pip3 install ….)
Other Useful Services sometimes featured:
-Amazon Web Services (AWS)
https://aws.amazon.com/
-Microsoft Azure
https://azure.microsoft.com/en-us/
-Google Cloud
https://cloud.google.com/
-Juypter Notebooks
https://jupyter.org/
Always looking for suggestions on what video to make next — leave me a comment with your project! Happy Coding!
Source
[ad_2]
I got invalid syntax which pointed to the last line mainloop(). Any ideas what's causing it?
How about the other way around ? i want to create a multiple notice letter generator based on data from the excel file and then save the letter as pdf
great content but can you maybe make a video how to share this also with non-Python users? I´ve tried to make an .exe file but it crashes for some reason….thx
great and amazing video. thank you for sharing
Tq for it…
But I wanted to create an New sheet and then insert values followed with sum of those values row wise and have printout option to get hardcopy of print.
Plz can u help me
AMAZING!!!!! Hats off Bro. Really Liked It.
Hey Derrick, quite useful, can we implement CRUD rights with database integration ? 2. How can we deploy for team ? Do we need to use Flask or Django? I need to make life easy for users many and many with various systems like Mac, Windows etc and they do not have to install python..
How to create a boolean entry?
Kudos, good job, big help, for me who is just getting into it but has work requirement that this helps with !
hey Derrick, i created a search button, how do i code the button to function for one click only?
yo this video has helped me alot. thanks dude
i want to write data into existing xls 2003 format file…. with python…
Derrick, any idea how to split values of random quantity and add additional columns? Say if some pc’s have two ip’s some have 4 separated by comma
Thank you Derrick. However, I've got an exception when I try to enter a new record, after submitting the first one? Any ideas?
Awesome… Short and to the point. This I can put to good use. Very informative.
Unable to import 'pandas'pylint(import-error)
please help how to fix it
God bless you
in Arabic ..
بارك الله فيك
i need help please ……
Exception in Tkinter callback
Traceback (most recent call last):
File "C:UsersHOMEAppDataLocalProgramsPythonPython38libtkinter_init__.py", line 1883, in __call_
return self.func(*args)
File "C:/Users/HOME/PycharmProjects/omar/P.py", line 29, in submit_fields
df2.to_excel(path, index=False)
File "C:UsersHOMEAppDataLocalProgramsPythonPython38libsite-packagespandascoregeneric.py", line 2175, in to_excel
formatter.write(
File "C:UsersHOMEAppDataLocalProgramsPythonPython38libsite-packagespandasioformatsexcel.py", line 726, in write
writer = ExcelWriter(stringify_path(writer), engine=engine)
File "C:UsersHOMEAppDataLocalProgramsPythonPython38libsite-packagespandasioexcel_openpyxl.py", line 18, in _init_
from openpyxl.workbook import Workbook
ModuleNotFoundError: No module named 'openpyxl'
Want to learn Python Programming while I am at Create a Database that produces Reports
Hey thanks for the video I have tonnes of questions….
Thank you. This is great!!
while running PermissionError: [Errno 13] Permission denied: 'file.xlsx' accrued. Could you please assist with it
Congratulations for your videos. I follow always . if possible to make a full formal desktop application with menu, graphic, forms, sqllite, etc. And a .Exe as product for distribution???
how to use the input from form as an input for a different program in another or same python file, instead of saving in a excel file? Please help
Excellent, could we have MS access like features in python,
great one
I like your videos Derrick, Good Job Bro..
Well done, bro. But… why you gotta stare into my soul? I'm just trying to learn some form making.
Wow, i thought it's just another one of these short crap programming videos. But yours is very useful and awesome..thanks and cheers from iraq.
Ur awesome thanks
Awesome brother, very knowlegdable
hi great video. would you mind to show how to write a similar script that is usable mobile phone to collect data in remote (without internet) hard to reach areas
I want to path a numerical value, not text value, because there are some codes i added to calculate the data entere, but data type is not numerical… Please help
Great help thanks !! include comments in your code to explain better and explain the purpose of functions, methods, and others when you write your code
you are so helpfull!!! tnx mate
Thanks
We need more like this video
how to install pandas –
Your file path is just the file name + extension. Does that file need to be stored somewhere specific for the code to find it, or can you define the file path as a full file path? Also, would you be able to define a path to a file that is stored on a sharepoint site?
Great Video! Thank you Derrick.
Thanks. Slightly modified to use with Jupyter
https://git.io/fj752
Great job!
Great vid!
Nice! thanks
Excellent video! Very useful! Thank you Derrick
Does the codes work on a Jupyter notebook. I tried but it does not work. pls advise.