How to download file from google drive using c#

Anand picture Anand · Aug 4, 2017 · Viewed 17.7k times · Source

I can't download file from google drive using below mentioned code

string url = https://drive.google.com/uc?export=download&id=XXXX
WebClient client = new WebClient();
client.Credential = new NetworkCredential("XXXX","XXXX");
client.DownloadFile(url,@"D:\\test.xls");

Could you please suggest me to how to download the file using webclient with user credential?