Reading a csv file on a Google drive without mapping

Wait! I logged out of Julia and login again. Seems like the upgrade has changed the problem. Now I get a never ending list of warnings.
Before you ask. I have validated the file many times. Import into Googlesheet and Excel has producrd no error. The file is not small but not that big either, around 3000 lines for 24 columns.

julia> using CSV, HTTP

julia> http_response = HTTP.get("https://drive.google.com/file/d/1IumdUeodd7LZWlwNoLRSNJdK8QkXBrpa/view?usp=drive_link")
HTTP.Messages.Response:
"""
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
X-Frame-Options: DENY
Set-Cookie: __Host-GAPS=1:Jhzs1tr8PwaXb1FoHS9VsnEkM1dQ6w:AwjO4gBarvHagKhX; Expires=Sun, 31-Aug-2025 15:32:10 GMT; Path=/; Secure; HttpOnly; Priority=HIGH
Vary: Sec-Fetch-Dest, Sec-Fetch-Mode, Sec-Fetch-Site
x-auto-login: realm=com.google&args=service%3Dwise%26continue%3Dhttps://drive.google.com/file/d/1IumdUeodd7LZWlwNoLRSNJdK8QkXBrpa/view?usp%253Ddrive_link
Link: <https://www.google.com/intl/en-US/drive/>; rel="canonical"
x-ua-compatible: IE=edge
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Mon, 01 Jan 1990 00:00:00 GMT
Date: Fri, 01 Sep 2023 15:32:10 GMT
Strict-Transport-Security: max-age=31536000; includeSubDomains
Cross-Origin-Resource-Policy: same-site
Accept-CH: Sec-CH-UA-Arch, Sec-CH-UA-Bitness, Sec-CH-UA-Full-Version, Sec-CH-UA-Full-Version-List, Sec-CH-UA-Model, Sec-CH-UA-WoW64, Sec-CH-UA-Form-Factor, Sec-CH-UA-Platform, Sec-CH-UA-Platform-Version
Content-Security-Policy: require-trusted-types-for 'script';report-uri /v3/signin/_/AccountsSignInUi/cspreport, script-src 'report-sample' 'nonce-yjUgDIzZbI90BsiykUIJhg' 'unsafe-inline';object-src 'none';base-uri 'self';report-uri /v3/signin/_/AccountsSignInUi/cspreport;worker-src 'self'
Permissions-Policy: ch-ua-arch=*, ch-ua-bitness=*, ch-ua-full-version=*, ch-ua-full-version-list=*, ch-ua-model=*, ch-ua-wow64=*, ch-ua-form-factor=*, ch-ua-platform=*, ch-ua-platform-version=*
Content-Encoding: gzip
Server: ESF
X-XSS-Protection: 0
X-Content-Type-Options: nosniff
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Transfer-Encoding: chunked

<!doctype html><html lang="en-US" dir="ltr"><head><base href="https://accounts.google.com/v3/signin/"><meta name="referrer" content="origin"><meta name="viewport" content="width=device-width, initial-scale=1"><style data-href="https://www.gstatic.com/_/mss/boq-identity/_/ss/k=boq-identity.AccountsSignInUi.RzbkUTW1gwA.L.X.O/am=hhwAITMeY4DyH0AACAAUKAAAAAAAAAAAAhkuIQ/d=1/ed=1/rs=AOaEmlHreNM4mwAMqhW8ZUYddR3uxy3KqQ/m=identifierview,_b,_tp,_r" nonce="8caWtgM3R7x-3ESHIXPP9Q">c-wiz{contain:style}c-wiz>c-data{display:none}c-wiz.rETSD{contain:none}c-wiz.Ubi8Z{contain:layout style}@-webkit-keyframes quantumWizBoxInkSpread{0%{-webkit-transform:translate(-50%,-50%) scale(0.2);-webkit-transform:translate(-50%,-50%) scale(0.2);-ms-transform:translate(-50%,-50%) scale(0.2);-o-transform:translate(-50%,-50%) scale(0.2);transform:translate(-50%,-50%) scale(0.2)}to{-webkit-transform:translate(-50%,-50%) scale(2.2);-webkit-transform:translate(-50%,-50%) scale(2.2);-ms-transform:translate(-50%,-50%) scale(2
⋮
627308-byte body
"""

julia> file = CSV.File(http_response.body)
┌ Warning: thread = 1 warning: only found 1 / 481 columns around data row: 1. Filling remaining columns with `missing`
└ @ CSV C:\Users\denys\.julia\packages\CSV\OnldF\src\file.jl:577
┌ Warning: thread = 1 warning: only found 2 / 481 columns around data row: 2. Filling remaining columns with `missing`
└ @ CSV C:\Users\denys\.julia\packages\CSV\OnldF\src\file.jl:577
┌ Warning: thread = 1 warning: only found 1 / 481 columns around data row: 3. Filling remaining columns with `missing`
└ @ CSV C:\Users\denys\.julia\packages\CSV\OnldF\src\file.jl:577
┌ Warning: thread = 1 warning: only found 2 / 481 columns around data row: 4. Filling remaining columns with `missing`
└ @ CSV C:\Users\denys\.julia\packages\CSV\OnldF\src\file.jl:577
┌ Warning: thread = 1 warning: only found 1 / 481 columns around data row: 5. Filling remaining columns with `missing`
└ @ CSV C:\Users\denys\.julia\packages\CSV\OnldF\src\file.jl:577
┌ Warning: thread = 1 warning: only found 2 / 481 columns around data row: 6. Filling remaining columns with `missing`
└ @ CSV C:\Users\denys\.julia\packages\CSV\OnldF\src\file.jl:577
┌ Warning: thread = 1 warning: only found 1 / 481 columns around data row: 7. Filling remaining columns with `missing`
└ @ CSV C:\Users\denys\.julia\packages\CSV\OnldF\src\file.jl:577
┌ Warning: thread = 1 warning: only found 1 / 481 columns around data row: 1. Filling remaining columns with `missing`
└ @ CSV C:\Users\denys\.julia\packages\CSV\OnldF\src\file.jl:577

Having not found a solution, I will close this.
I will ask my users to convert the csv file into a googlesheet and I will work from there using GoogleSheets.jl.

Thanks to all who have contributed to this.

1 Like

Your http response shows the body of the response is a html file. That doesn’t work to read in as a Csv. You need to make sure that your download link actually gives you a csv

<!doctype html><html lang="en-US" dir="ltr"><head>...

That html is probably the page saying “you’re not authenticated to download this” because you’re not sending along the right authentication headers.

1 Like