Automate Multiple Excel Sheet Graphing – Python & Pandas

Automate Multiple Excel Sheet Graphing – Python & Pandas

Using Pandas & Python To Automate Excel Reporting

Businesses depend on Excel – probably too much. Companies use excel for everything: information gathering, data analysis, as a database, and so much more. With the huge number of excel sheets floating around the office, it becomes necessary to use a more ‘high powered” solution to graph this data.

 

This code along tutorial shows us how we can combine data from an unlimited number of spreadsheets to create visual representations from the mountains of data. 

Below is the full code used in the tutorial:

##Requirements:
#Python
#matplotlib
#Pandas
###############

#Import Modules
import pandas
import matplotlib.pyplot as plt


# Script
ExcelWorkbook = "Workbook2.xlsx"
df = pandas.read_excel(ExcelWorkbook)

#Test to make sure data is loaded
print(df.head())

#Pull out columns for graph
#Unneccesary for final graph, but good indication if all your data is being read in.
values = df[['Locations','Profit']]
print(values)

# Bar Chart

ax = values.plot.bar(x='Locations', y='Profit', rot=0)
plt.show()

The above code can be found on my github Here.

Feel free to leave me comments on the Youtube video located Here.

If you have suggestions or comments on what else you would like to see (Or Improvements to this script – let me know!)

Happy Coding!

Leave a Reply

Your email address will not be published. Required fields are marked *