Web Scraping20 min read

Saving Data to CSV

Learn how to store scraped data into CSV files for Excel and analysis.

David Miller
November 19, 2025
2.5k73

Scraping is useless if you don’t save data.

CSV is simple and universal.

Writing CSV

import csv

rows = [
  ["Name", "Price"],
  ["Laptop", "900"],
  ["Phone", "500"]
]

with open("products.csv", "w", newline="", encoding="utf-8") as f:
    writer = csv.writer(f)
    writer.writerows(rows)

Graph

flowchart LR
  A[Scraped Data] --> B[CSV File]
  B --> C[Excel / Analysis]

Remember

  • CSV works everywhere
  • Always add headers
#Python#Intermediate#Storage