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]

Comment List

  • Derrick Sherrill
    January 14, 2021

    I got invalid syntax which pointed to the last line mainloop(). Any ideas what's causing it?

  • Derrick Sherrill
    January 14, 2021

    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

  • Derrick Sherrill
    January 14, 2021

    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

  • Derrick Sherrill
    January 14, 2021

    great and amazing video. thank you for sharing

  • Derrick Sherrill
    January 14, 2021

    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

  • Derrick Sherrill
    January 14, 2021

    AMAZING!!!!! Hats off Bro. Really Liked It.

  • Derrick Sherrill
    January 14, 2021

    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..

  • Derrick Sherrill
    January 14, 2021

    How to create a boolean entry?

  • Derrick Sherrill
    January 14, 2021

    Kudos, good job, big help, for me who is just getting into it but has work requirement that this helps with !

  • Derrick Sherrill
    January 14, 2021

    hey Derrick, i created a search button, how do i code the button to function for one click only?

  • Derrick Sherrill
    January 14, 2021

    yo this video has helped me alot. thanks dude

  • Derrick Sherrill
    January 14, 2021

    i want to write data into existing xls 2003 format file…. with python…

  • Derrick Sherrill
    January 14, 2021

    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

  • Derrick Sherrill
    January 14, 2021

    Thank you Derrick. However, I've got an exception when I try to enter a new record, after submitting the first one? Any ideas?

  • Derrick Sherrill
    January 14, 2021

    Awesome… Short and to the point. This I can put to good use. Very informative.

  • Derrick Sherrill
    January 14, 2021

    Unable to import 'pandas'pylint(import-error)

    please help how to fix it

  • Derrick Sherrill
    January 14, 2021

    God bless you
    in Arabic ..
    بارك الله فيك

  • Derrick Sherrill
    January 14, 2021

    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'

  • Derrick Sherrill
    January 14, 2021

    Want to learn Python Programming while I am at Create a Database that produces Reports

  • Derrick Sherrill
    January 14, 2021

    Hey thanks for the video I have tonnes of questions….

  • Derrick Sherrill
    January 14, 2021

    Thank you. This is great!!

  • Derrick Sherrill
    January 14, 2021

    while running PermissionError: [Errno 13] Permission denied: 'file.xlsx' accrued. Could you please assist with it

  • Derrick Sherrill
    January 14, 2021

    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???

  • Derrick Sherrill
    January 14, 2021

    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

  • Derrick Sherrill
    January 14, 2021

    Excellent, could we have MS access like features in python,

  • Derrick Sherrill
    January 14, 2021

    great one

  • Derrick Sherrill
    January 14, 2021

    I like your videos Derrick, Good Job Bro..

  • Derrick Sherrill
    January 14, 2021

    Well done, bro. But… why you gotta stare into my soul? I'm just trying to learn some form making.

  • Derrick Sherrill
    January 14, 2021

    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.

  • Derrick Sherrill
    January 14, 2021

    Ur awesome thanks

  • Derrick Sherrill
    January 14, 2021

    Awesome brother, very knowlegdable

  • Derrick Sherrill
    January 14, 2021

    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

  • Derrick Sherrill
    January 14, 2021

    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

  • Derrick Sherrill
    January 14, 2021

    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

  • Derrick Sherrill
    January 14, 2021

    you are so helpfull!!! tnx mate

  • Derrick Sherrill
    January 14, 2021

    Thanks
    We need more like this video

  • Derrick Sherrill
    January 14, 2021

    how to install pandas –

  • Derrick Sherrill
    January 14, 2021

    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?

  • Derrick Sherrill
    January 14, 2021

    Great Video! Thank you Derrick.

  • Derrick Sherrill
    January 14, 2021

    Thanks. Slightly modified to use with Jupyter

    https://git.io/fj752

  • Derrick Sherrill
    January 14, 2021

    Great job!

  • Derrick Sherrill
    January 14, 2021

    Great vid!

  • Derrick Sherrill
    January 14, 2021

    Nice! thanks

  • Derrick Sherrill
    January 14, 2021

    Excellent video! Very useful! Thank you Derrick

  • Derrick Sherrill
    January 14, 2021

    Does the codes work on a Jupyter notebook. I tried but it does not work. pls advise.

Write a comment