# Importing xlrd library for reading Excel files

**URL:** <https://forum.inductiveautomation.com/t/importing-xlrd-library-for-reading-excel-files/53332>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [November 22, 2021, 12:07pm UTC](https://forum.inductiveautomation.com/t/importing-xlrd-library-for-reading-excel-files/53332 "2021-11-22T12:07:57Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![g.cascales](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@g.cascales](https://forum.inductiveautomation.com/u/g.cascales)\
**Post date:** [November 22, 2021, 2:59pm UTC](https://forum.inductiveautomation.com/t/importing-xlrd-library-for-reading-excel-files/53332/4 "2021-11-22T14:59:51Z")

</div>

Dear all,

I used this solution as indicated by @pturmel

> [@Copying an Excel file to a table's dataset](https://forum.inductiveautomation.com/t/copying-a-excel-file-to-a-tables-dataset/34942/13):
>
> Got my paperwork done early, so here's a sample to read from an Excel file EDIT: Reworked a bit to work with both .xls and .xlsx files EDIT: Modified to properly cast data types EDIT: Added handler for formula cell types EDIT: Added parameters to optionally specify sheet, row, and column numbers Reading back a file created from my other example: def excelToDataSet(fileName, hasHeaders = False, sheetNum = 0, firstRow = None, lastRow = None, firstCol = None, lastCol = None): import org.apac…

Works as I expected.

Thanks!!!

---

_[View the full topic](https://forum.inductiveautomation.com/t/importing-xlrd-library-for-reading-excel-files/53332)._
