How to Read an Excel File in Julia Language? An example.

This article shortly describes how to read an Excel file into Julia. Generally, one can use different libraries to read Excel files, including XLSXReaderExcelReaders or Taro. In this tutorial I will focus on Taro as it created the fewest problems and provides – at least in my eyes – an easy to understand syntax.

In order to read an Excel file form your computer into Julia it is sufficient to execute the following lines of code. However, if you want to download the Excel file directly from the web and read it into Julia you should look at this post.

 
# in case you have not installed to Pkg yet
Pkg.add("Taro")

# load Taro - Pkg to read Excel Data
using Taro
Taro.init()

# get data
df = Taro.readxl("path to Excel", "sheet1", "A1:C357")

This code will read the selected data fields, i.e. field A1 to field C357, of sheet1 into a dataframe in Julia. You can also directly consult the documentation of the Taro Package here.

Advertisement

One thought on “How to Read an Excel File in Julia Language? An example.”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.