1

I want to read the data in google spread using c#.I am able to authenticate google drive but I am unable to read the data in google spread sheet.I have used following code

   SpreadsheetsService myService = new SpreadsheetsService("Sample ProjectSheets");
     myService.setUserCredentials(My emailid, My password);
    SpreadsheetQuery query = new SpreadsheetQuery();
    SpreadsheetFeed feed = myService.Query(query);

In the above code , I am getting exception at myService.Query(query) as An unhandled exception of type 'Google.GData.Client.GDataRequestException' occurred in Google.GData.Client.dll and build the above code by refering following link:Accessing Google Spreadsheets with C# using Google Data API. I have one more doubt what to mention as application name in SpreadsheetsService object.

Community
  • 1
  • 1
prasanthi
  • 562
  • 1
  • 9
  • 25
  • Please show the detail of the exception. Also note that you're referring to an answer from 2009. I would strongly encourage you to use a more recent API, e.g. https://www.nuget.org/packages/Google.Apis.Sheets.v4/ – Jon Skeet Apr 07 '17 at 10:44
  • See https://developers.google.com/sheets/api/quickstart/dotnet for a .NET quick start – Jon Skeet Apr 07 '17 at 10:46
  • This is the exception getting for me **An unhandled exception of type 'Google.GData.Client.GDataRequestException' occurred in Google.GData.Client.dll** – prasanthi Apr 07 '17 at 10:48
  • In this link https://developers.google.com/sheets/api/quickstart/dotnet . I have doubt in step-3 at this point of code string credPath = System.Environment.GetFolderPath( System.Environment.SpecialFolder.Personal); credPath = Path.Combine(credPath, ".credentials/sheets.googleapis.com-dotnet-quickstart.json"); here What are parameters are passing to **path.combine** method?Is the **.credentials/sheets.googleapis.com-dotnet-quickstart.json** default path or custom path – prasanthi Apr 07 '17 at 10:51
  • I'm not sure what you mean by "default path or custom path". It's just a place to store the credentials for that demo application. – Jon Skeet Apr 07 '17 at 11:17
  • Okay @JonSkeet . You have said that it is for to store the credentials then where should i can store in my application. – prasanthi Apr 07 '17 at 11:35
  • Pick a directory... we have no idea what kind of application you're writing, which makes it hard to know where you'd want to store that information. But fundamentally that's not a Google Sheets question... – Jon Skeet Apr 07 '17 at 12:20

0 Answers0