Click here to Skip to main content
15,893,588 members
Home / Discussions / C#
   

C#

 
GeneralRe: How do I add 3 objects to array in C# Pin
PIEBALDconsult19-Apr-15 9:01
mvePIEBALDconsult19-Apr-15 9:01 
GeneralRe: How do I add 3 objects to array in C# Pin
Sascha Lefèvre19-Apr-15 9:03
professionalSascha Lefèvre19-Apr-15 9:03 
GeneralRe: How do I add 3 objects to array in C# Pin
Aindriu Mac Giolla Eoin19-Apr-15 9:13
Aindriu Mac Giolla Eoin19-Apr-15 9:13 
GeneralRe: How do I add 3 objects to array in C# Pin
Sascha Lefèvre19-Apr-15 9:16
professionalSascha Lefèvre19-Apr-15 9:16 
GeneralRe: How do I add 3 objects to array in C# Pin
Aindriu Mac Giolla Eoin19-Apr-15 9:24
Aindriu Mac Giolla Eoin19-Apr-15 9:24 
GeneralRe: How do I add 3 objects to array in C# Pin
Sascha Lefèvre19-Apr-15 9:27
professionalSascha Lefèvre19-Apr-15 9:27 
GeneralRe: How do I add 3 objects to array in C# Pin
Aindriu Mac Giolla Eoin19-Apr-15 9:32
Aindriu Mac Giolla Eoin19-Apr-15 9:32 
QuestionGoogle Spreadsheets API - Getting Data into dataGridView? Pin
Linus Agren19-Apr-15 6:00
Linus Agren19-Apr-15 6:00 
Hi there.

I am making an application to manage data in some google spreadsheets.
I have all the References I need, and I can retrieve the data from spreadsheet decently I think, but how can I get all the data into my dataGridView properly?

I have low knowledge in C# generally, and virtually no experience with Google API, but I have sat down for hours now trying to figure it out.

I used this page[^] as a guide, but it doesn't contain any information whatsoever.

My code looks like this:
C#
public Form1()
{
    InitializeComponent();

    //authenticate
    SpreadsheetsService wsService = new SpreadsheetsService("testApp");
    wsService.setUserCredentials("email@gmail.com", "password");

    //retrieve available spreadsheets
    SpreadsheetQuery query = new SpreadsheetQuery();
    SpreadsheetFeed feed = wsService.Query(query);

    foreach (SpreadsheetEntry entry in feed.Entries)
    {
        comboBox1.Items.Add(entry.Title.Text.ToString());
    }
}

private void button1_Click(object sender, EventArgs e)
{
    int sheetIndex = comboBox1.SelectedIndex;

    SpreadsheetsService wsService = new SpreadsheetsService("testApp");
    wsService.setUserCredentials("email@gmail.com", "password");

    SpreadsheetQuery query = new SpreadsheetQuery();
    SpreadsheetFeed feed = wsService.Query(query);

    //retrieve the worksheets of a particular spreadsheet
    SpreadsheetEntry mySpreadsheet = (SpreadsheetEntry)feed.Entries[sheetIndex];
    AtomLink link = mySpreadsheet.Links.FindService(GDataSpreadsheetsNameTable.WorksheetRel, null);

    WorksheetQuery wQuery = new WorksheetQuery(link.HRef.ToString());
    WorksheetFeed wFeed = wsService.Query(wQuery);

    //retrieve the cells in a worksheet
    WorksheetEntry worksheetEntry = (WorksheetEntry)wFeed.Entries[0];
    AtomLink cLink = worksheetEntry.Links.FindService(GDataSpreadsheetsNameTable.CellRel, null);

    CellQuery cQuery = new CellQuery(cLink.HRef.ToString());
    CellFeed cFeed = wsService.Query(cQuery);

    foreach (CellEntry curCell in cFeed.Entries)
    {
        Debug.WriteLine("The value on row {0} and column {1} is {2}", curCell.Cell.Row,
        curCell.Cell.Column, curCell.Cell.Value);
    }
}


I really appreciate your effort on helping me.
Thanks in advance! Rose | [Rose]
AnswerRe: Google Spreadsheets API - Getting Data into dataGridView? Pin
Linus Agren20-Apr-15 18:04
Linus Agren20-Apr-15 18:04 
QuestionCatch Win+Left (Aero-Snap)? Pin
SledgeHammer0118-Apr-15 16:01
SledgeHammer0118-Apr-15 16:01 
AnswerRe: Catch Win+Left (Aero-Snap)? Pin
Dave Kreskowiak18-Apr-15 18:47
mveDave Kreskowiak18-Apr-15 18:47 
GeneralRe: Catch Win+Left (Aero-Snap)? Pin
SledgeHammer0118-Apr-15 20:19
SledgeHammer0118-Apr-15 20:19 
SuggestionRe: Catch Win+Left (Aero-Snap)? Pin
Richard Deeming20-Apr-15 2:34
mveRichard Deeming20-Apr-15 2:34 
QuestionHow do I add an object to a list within a class? Pin
Doncal18-Apr-15 9:43
Doncal18-Apr-15 9:43 
AnswerRe: How do I add an object to a list within a class? Pin
Pete O'Hanlon18-Apr-15 10:06
mvePete O'Hanlon18-Apr-15 10:06 
AnswerRe: How do I add an object to a list within a class? Pin
Sascha Lefèvre18-Apr-15 10:09
professionalSascha Lefèvre18-Apr-15 10:09 
AnswerRe: How do I add an object to a list within a class? Pin
Doncal18-Apr-15 10:24
Doncal18-Apr-15 10:24 
GeneralRe: How do I add an object to a list within a class? Pin
Sascha Lefèvre18-Apr-15 10:27
professionalSascha Lefèvre18-Apr-15 10:27 
GeneralRe: How do I add an object to a list within a class? Pin
BillWoodruff18-Apr-15 17:28
professionalBillWoodruff18-Apr-15 17:28 
GeneralRe: How do I add an object to a list within a class? Pin
Sascha Lefèvre19-Apr-15 0:44
professionalSascha Lefèvre19-Apr-15 0:44 
QuestionWindows remote desktop but all in HTML Pin
Dr Gadgit18-Apr-15 6:23
Dr Gadgit18-Apr-15 6:23 
QuestionCreate Chart in Excel with C# Pin
Member 836750218-Apr-15 2:17
Member 836750218-Apr-15 2:17 
AnswerRe: Create Chart in Excel with C# Pin
Brisingr Aerowing18-Apr-15 12:24
professionalBrisingr Aerowing18-Apr-15 12:24 
Questionfloat to and from frequency Pin
DaveyM6917-Apr-15 10:06
professionalDaveyM6917-Apr-15 10:06 
AnswerRe: float to and from frequency Pin
Sascha Lefèvre17-Apr-15 11:02
professionalSascha Lefèvre17-Apr-15 11:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.