Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel Python API

Tags:

Does anyone know of a way of accessing MS Excel from Python? Specifically I am looking to create new sheets and fill them with data, including formulae.

Preferably I would like to do this on Linux if possible, but can do it from in a VM if there is no other way.

like image 329
Jim Jeffries Avatar asked Jul 14 '11 18:07

Jim Jeffries


People also ask

Can you use Python with Excel?

Excel is a popular and powerful spreadsheet application for Windows. The openpyxl module allows your Python programs to read and modify Excel spreadsheet files.

Is there an API for Excel?

Introduced with Office 2016, the Excel JavaScript API provides strongly-typed objects that you can use to access worksheets, ranges, tables, charts, and more.

Can I use Python to automate Excel?

Overall, Python Excel Automation is an innovative process that you can use to create visual reports on Python just the same way as you would on Excel seamlessly. Organizations can leverage Python Excel Automation to leverage their business tasks according to their needs.

Can Excel talk to an API?

APIs and ExcelYou can communicate with an API by sending and receiving text strings. The most common formats for these strings are known as JSON and REST .


2 Answers

xlwt and xlrd can read and write Excel files, without using Excel itself:

http://www.python-excel.org/

like image 111
Thomas K Avatar answered Sep 24 '22 14:09

Thomas K


Long time after the original question, but last answer pushed it top of feed again. Others might benefit from my experience using python and excel.

I am using excel and python quite bit. Instead of using the xlrd, xlwt modules directly, I normally use pandas. I think pandas uses these modules as imports, but i find it much easier using the pandas provided framework to create and read the spreadsheets. Pandas's Dataframe structure is very "spreadsheet-like" and makes life a lot easier in my opinion.

The other option that I use (not in direct answer to your problem) is DataNitro. It allows you to use python directly within excel. Different use case, but you would use it where you would normally have to write VBA code in Excel.

like image 21
Joop Avatar answered Sep 21 '22 14:09

Joop