Hi sir,

This is working superb.
But if i want to display a ".xls" file on web page as spreadsheet,
then how i display

Thanks in advance.

Regards,
Mandar Mhatre.

Jdbholmes wrote:
> This is something i have been looking for and finally built myself
>
> you can use this spreadsheet as a reference
> http://spreadsheets.google.com/pub?key=pbGrwCFgRyo50EOthfr7EQg
>
> and here is the .net code
>
> C# CODE
> using System;
> using System.Data;
> using System.Configuration;
> using System.Collections;
> using System.Web;
> using System.Web.Security;
> using System.Web.UI;
> using System.Web.UI.WebControls;
> using System.Web.UI.WebControls.WebParts;
> using System.Web.UI.HtmlControls;
> using Google.GData.Client;
> using Google.GData.Extensions;
> using Google.GData.Spreadsheets;
>
> public partial class site_controls_stock_lookup : System.Web.UI.Page
> {
>     protected void Page_Load(object sender, EventArgs e)
>     {
>         DataTable dt = new DataTable();
>         try
>         {
>             SpreadsheetsService service = new
> SpreadsheetsService("STOCK-LOOKUP");
>             service.setUserCredentials("YOUR GMAIL ACCOUNT", "YOUR
> PASS");
>             SpreadsheetQuery query = new SpreadsheetQuery();
>             query.Title = "STOCK_LOOKUP_DEMO";
>             SpreadsheetFeed feed = service.Query(query);
>             if (feed.Entries.Count != 1) return;
>
>             AtomLink link =
> feed.Entries[0].Links.FindService(GDataSpreadsheetsNameTable.WorksheetRel,
> null);
>             WorksheetQuery worksheetQuery = new
> WorksheetQuery(link.HRef.ToString());
>             worksheetQuery.Title = "Sheet1";
>             WorksheetFeed worksheetFeed =
> service.Query(worksheetQuery);
>             if (worksheetFeed.Entries.Count != 1) return;
>
>             WorksheetEntry worksheet =
> (WorksheetEntry)worksheetFeed.Entries[0];
>
>
>             AtomLink listFeedLink =
> worksheet.Links.FindService(GDataSpreadsheetsNameTable.ListRel, null);
>
>             ListQuery listQuery = new
> ListQuery(listFeedLink.HRef.ToString());
>             ListFeed listFeed = service.Query(listQuery);
>             // define the table's schema
>             dt.Columns.Add(new DataColumn("Stock", typeof(string)));
>             dt.Columns.Add(new DataColumn("High", typeof(string)));
>             dt.Columns.Add(new DataColumn("Low", typeof(string)));
>             foreach (ListEntry worksheetRow in listFeed.Entries)
>             {
>                 string station = string.Empty;
>                 string scanData =
> worksheetRow.Elements[0].Value.ToString();
>                 string scanData1 =
> worksheetRow.Elements[1].Value.ToString();
>                 string scanData2 =
> worksheetRow.Elements[2].Value.ToString();
>                 string[] arSD = new string[100];
>
>
>                 DataRow dr = dt.NewRow();
>                 dr["Stock"] = scanData;
>                 dr["High"] = scanData1;
>                 dr["Low"] = scanData2;
>
>
>                 dt.Rows.Add(dr);
>
>             }
>
>             GridView1.DataSource = dt;
>             GridView1.DataBind();
>             Page.DataBind();
>         }
>
>         catch (Exception ex)
>         {
>         }
>
>     }
> }
>
>
> ASPX Code
>
> <%@ Page Language="C#" AutoEventWireup="true"
> CodeFile="stock_lookup.aspx.cs" Inherits="site_controls_stock_lookup"
> %>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
> www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
> <html xmlns="http://www.w3.org/1999/xhtml"; >
> <head runat="server">
>     <title>Untitled Page</title>
> </head>
> <body>
>     <form id="form1" runat="server">
>     <div>
>
> <asp:GridView ID="GridView1" Runat="server"  >
>
> </asp:GridView>
>
>         </div>
>     </form>
> </body>
> </html>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Docs Data APIs" group.
To post to this group, send email to Google-Docs-Data-APIs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to