Skip to main content

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.

Buy Me A Coffee

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)

Source distribution for scrapy-xls 0.0.1
File Size Uploaded
scrapy_xls-0.0.1.tar.gz 3.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scrapy-xls 0.0.1
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page