Save Excel file in Python through Scrapy

0

How do I make my spider save in a single XML file all the Excel data from the links that I extract? Or do you also save in each single XLS file in the project folder?

Part of my spider:

def parse(self, response):
    divs = response.xpath('''meu caminho html''')
    for div in divs:
        #o arquivo xls sai dessa html
        links = div.xpath('.//a/@href').extract_first()
        yield {'Links': links,}
    
asked by anonymous 14.05.2018 / 20:53

1 answer

1

The excel export format is not supported, but scrapy supports:

  • JSON
  • JSON lines
  • CSV
  • XML

You can use the CSV format:

scrawl nome_do_spider -t csv -o planilha.csv
    
11.06.2018 / 15:04