0

i'm trying to save a CSV dataset from a URL, but when I save and open the CSV File it shows me the html code. I'm trying:

import requests
import csv

URL = 'https://docs.google.com/spreadsheets/d/1PS2_yAvNVEuSY0gI8Nky73TQMcx_G1i18lm--jOGfAA/edit#gid=514147473'
response = requests.get(URL)

url_content = response.content
csv_file = open('challenge1.csv', 'wb')

csv_file.write(url_content)
csv_file.close()

When I open the csv file it shows me something like:

<!DOCTYPE html><html lang="en-US"><head><script nonce="LgkumbTR7XWYUjD0NWz0jw">var DOCS_timing={}

Cod_Loc,IdProvincia,IdDepartamento,Observaciones,categoria,subcategoria,provincia,localidad,nombre,direccion,piso,CP,cod_area,telefono,Mail,Web,Latitud,Longitud,TipoLatitudLongitud,Info_adicional

6588100,6,6588,Espacios de Exhibición Patrimonial,Museos,Buenos Aires,9 de ..."><meta name="google" content="notranslate"><meta http-equiv="X-UA-Compatible" content="IE=edge

How can I do to see the relevant information in tabular mode?

0 Answers0