Python Forum
opening your scraping with a csv file in excel??
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
opening your scraping with a csv file in excel??
#1
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?
buran write Jan-27-2021, 03:59 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need help opening pages when web scraping templeowls 1 273 Feb-29-2024, 06:45 PM
Last Post: snippsat
  Loading excel file in python MMOTIAA 0 1,090 Mar-01-2022, 06:28 AM
Last Post: MMOTIAA
  Web Page not opening while web scraping through python selenium sumandas89 4 10,004 Nov-19-2018, 02:47 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020