XLS Scrapy Spider
Scrapy spider for parsing XLS files. It receives a XLS file in a response; iterates through each of its rows, and calls parse_row with a dict containing each field's data and the sheet name. Inspired in the builtin CSV feed scrapy spider.
This is built on top of openpyxl and pandas libs, you can set some options regarding the XLS file, such as the sheet names and number of rows to be skiped. If sheets are not provided, it'll returns all sheets available.
Installation
pip install scrapy_xls
How to use
from scrapy_xls import XLSSpider
def SuperMarketCatalogSpider(XLSSpider):
start_urls = [
'https://www.supermarket.com/files/catalog-oct-22.xlsx',
'https://www.supermarket.com/files/catalog-set-22.xlsx',
]
skip_rows = 3 # Assuming that the sheet headers starts at the 4th row
sheets = ['FRUITS', 'BEVERAGES']
def parse_row(self, response, sheet, row):
item = {}
item['department'] = sheet
item['product'] = row['NAME']
item['price'] = row['PRICE']
item['brand'] = row['BRAND']
yield item
Contributing
Feel free to contribute with the project. Git repository.
Metadata
Release files for scrapy-xls 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| scrapy_xls-0.0.1.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scrapy_xls-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.5 kB
Release files / scrapy_xls-0.0.1.tar.gz
| Download URL | scrapy_xls-0.0.1.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dcda83262bf0ed2327e1ab86c2550e256968df1b1e6c8baeaee72908c2d19833
|
|
BLAKE2b-256 checksum How to use checksums |
c9a48b9bab48400e1b6d4c62dc7e31b51a41748e3418459463c0c236c5886009
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.7.5
|
Release files / scrapy_xls-0.0.1-py3-none-any.whl
| Download URL | scrapy_xls-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a206654f843d336f5bb879606d67d6deb913fd0de3d1497102437c62723fa49
|
|
BLAKE2b-256 checksum How to use checksums |
32551a6afd069225d5036d3303eda5044e1597e34967393f9bdc27d04919cc22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.7.5
|