h2oai / h2oai/datatable

[FR] fread should read excel files from url

Open
#2,631 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.9k
Forks
164
Avg merge
7h 31m
Merged PRs (30d)
1

Description

Attempted reading an excel file from a url and it failed. I believe it is something that could be implemented.

```python
url = 'https://github.com/samukweku/Extracting-Data-from-Excel-with-Python/blob/master/names.xlsx?raw=true'

---------------------------------------------------------------------------
IOError Traceback (most recent call last)
in
----> 1 fread(url)

IOError: https://github.com/samukweku/Extracting-Data-from-Excel-with-Python/blob/master/names.xlsx is an HTML file. Please open it in a browser and then save in a plain text format.
```

I know `xlrd` supports reading from a url (at least there is a way around it); not sure if there is a design decision of not being able to read excel files from a url.

When read with `pandas`, it works fine :
```python
pd.read_excel(url)
Name Age Height
0 Tolu 24 2.0
1 Chukwuka 50 1.8
2 Ogor 15 1.5
```

If I download the file and read with `fread` it works :
```python
import urllib

filename = 'test.xlsx'

urllib.request.urlretrieve(url, filename)

fread("test.xlsx/naija")

Name Age Height
0 Tolu 24 2.0
1 Chukwuka 50 1.8
2 Ogor 15 1.5
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.