Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Extending Excel with Python and R

You're reading from  Extending Excel with Python and R

Product type Book
Published in Apr 2024
Publisher Packt
ISBN-13 9781804610695
Pages 344 pages
Edition 1st Edition
Languages
Authors (2):
Steven Sanderson Steven Sanderson
Profile icon Steven Sanderson
David Kun David Kun
Profile icon David Kun
View More author details

Table of Contents (20) Chapters

Preface 1. Part 1:The Basics – Reading and Writing Excel Files from R and Python
2. Chapter 1: Reading Excel Spreadsheets 3. Chapter 2: Writing Excel Spreadsheets 4. Chapter 3: Executing VBA Code from R and Python 5. Chapter 4: Automating Further – Task Scheduling and Email 6. Part 2: Making It Pretty – Formatting, Graphs, and More
7. Chapter 5: Formatting Your Excel Sheet 8. Chapter 6: Inserting ggplot2/matplotlib Graphs 9. Chapter 7: Pivot Tables and Summary Tables 10. Part 3: EDA, Statistical Analysis, and Time Series Analysis
11. Chapter 8: Exploratory Data Analysis with R and Python 12. Chapter 9: Statistical Analysis: Linear and Logistic Regression 13. Chapter 10: Time Series Analysis: Statistics, Plots, and Forecasting 14. Part 4: The Other Way Around – Calling R and Python from Excel
15. Chapter 11: Calling R/Python Locally from Excel Directly or via an API 16. Part 5: Data Analysis and Visualization with R and Python for Excel Data – A Case Study
17. Chapter 12: Data Analysis and Visualization with R and Python in Excel – A Case Study 18. Index 19. Other Books You May Enjoy

Technical requirements

At the time of writing, we are using the following:

  • R 4.2.1
  • The RStudio 2023.03.1+446 “Cherry Blossom” release for Windows

For this chapter, you will need to install the following packages:

  • readxl
  • openxlsx
  • xlsx

To run the Python code in this chapter, we will be using the following:

  • Python 3.11
  • pandas
  • openpyxl
  • The iris.xlsx Excel file available in this book’s GitHub repository

While setting up a Python environment is outside the scope of this book, this is easy to do. The necessary packages can be installed by running the following commands:

python -m pip install pandas==2.0.1
python -m pip install openpyxl==3.1.2

Note that these commands have to be run from a terminal and not from within a Python script. They need to be run in the folder where requirements.txt resides or a full path to the requirements.txt file has to be included.

This book’s GitHub repository also contains a requirements.txt file that you can use to install all dependencies. You can do this by running the following command:

python -m pip install -r requirements.txt

This command installs all the packages that will be used in this chapter so that you don’t have to install them one by one. It also guarantees that the whole dependency tree (including the dependencies of the dependencies) will be the same as what this book’s authors have used.

Alternatively, when using Jupyter Notebooks, you can use the following magic commands:

%pip install pandas==2.0.1
%pip install openpyxl==3.1.2

There is a GitHub account for all of the code examples in this book located at this link: https://github.com/PacktPublishing/Extending-Excel-with-Python-and-R. Each chapter has it’s own folder, with the current one as Chapter01.

Note

Technical requirements for Python throughout the book are conveniently compiled in the requirements.txt file, accessible on GitHub repository here, https://github.com/PacktPublishing/Extending-Excel-with-Python-and-R/blob/main/requirements.txt. Installing these dependencies will streamline your coding experience and ensure smooth progression through the book. Be sure to install them all before diving into the exercises.

You have been reading a chapter from
Extending Excel with Python and R
Published in: Apr 2024 Publisher: Packt ISBN-13: 9781804610695
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}