Python Forum

Full Version: opening your scraping with a csv file in excel??
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i made this web scraper in reference to a school project. And i am trying to get all my scraped information printed out in a form/table into excel. at the beginning of my code i am opening a csv file and writing the rows that i want by using the

import csv
csv_file = open('cms_example.csv', 'w')
csv_writer = csv.writer(csv_file)
csv_writer.writerow(['Type-navn', 'Markedspris',
                     'Pris', 'Tilbud', 'Rabat', 'Link'])
at the buttom i am putting all the variabels in to rows lik so:

csv_writer.writerow(
        [name, Old_price, regular_price, new_price, Rabat, link])

csv_file.close()
I have seen this video: https://www.youtube.com/watch?v=ng2o98k983k by corey schafer and i am opening, writing and closing the csv file as showed in this video. but of som how i can't get the scraped information under the right columns in excel. plus some of the scraped titles get deleted. i have tried to do the "from text to columns" process in excel and i have tried to import the csv file directly into the excel sheet. but i really can't figure out why all the information isn't under the right columns. how do i do this?