Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8092401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:16:34+00:00 2026-06-05T20:16:34+00:00

use C#,want to upload excel file on google doc. bellow syntax use to upload

  • 0

use C#,want to upload excel file on google doc. bellow syntax use to upload a xls file

//use Content-Type: text/csv
     entry.MediaSource = new MediaFileSource("E:\\Emailcontent.xls", "text/csv");

but it’s not working ,after upload file convert to csv .But i don’t want this conversion.I just want to upload my excel file in my google doc.Help me to upload excel file with out conversion.Thanks in advanced

  string USERNAME = "xxx@gmail.com";
            string PASSWORD = "xxxxx";

            // Start the service and set credentials
            DocumentsService service = new DocumentsService("MyDocumentsListIntegration-v1");
            service.setUserCredentials(USERNAME, PASSWORD);
            Authenticator authenticator = new ClientLoginAuthenticator("TestApi", Google.GData.Client.ServiceNames.Documents, service.Credentials);
            DocumentEntry entry = new DocumentEntry();
            // Set the document title
            entry.Title.Text = "Legal Contract";
            entry.IsSpreadsheet = true;
            // Set the media source
            //entry.MediaSource = new MediaFileSource("E:\\New Microsoft Office Word Document.doc", "application/msword");
            entry.MediaSource = new MediaFileSource("E:\\Emailcontent.xls", "text/csv");
            // Define the resumable upload link
            Uri createUploadUrl = new Uri("https://docs.google.com/feeds/upload/create-session/default/private/full");
            AtomLink link = new AtomLink(createUploadUrl.AbsoluteUri);
            link.Rel = ResumableUploader.CreateMediaRelation;
            entry.Links.Add(link);

            // Set the service to be used to parse the returned entry
            entry.Service = service;

            // Instantiate the ResumableUploader component.
            ResumableUploader uploader = new ResumableUploader();

            // Set the handlers for the completion and progress events
            uploader.AsyncOperationCompleted += new AsyncOperationCompletedEventHandler(OnDone);
            uploader.AsyncOperationProgress += new AsyncOperationProgressEventHandler(OnProgress);

            // Start the upload process
            uploader.InsertAsync(authenticator, entry, new object());
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:16:35+00:00Added an answer on June 5, 2026 at 8:16 pm

    You are passing an xls (Excel) file as a text/csv. If you want to upload as xls, use

    entry.MediaSource = new MediaFileSource("E:\\Emailcontent.xls", "text/csv");    
    

    If you want to upload as xls, use

    entry.MediaSource = new MediaFileSource("E:\\Emailcontent.xls", "application/vnd.ms-excel"); 
    

    Here is the wikipedia/google search that I used:

    http://en.wikipedia.org/wiki/Internet_media_type

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to upload a CSV file and use it just for import content.
I want to upload an image use something like <form ...> <input type=file id=upload></input>
I use the PHP language for file upload and want to know that the
For debug use I want to show the type of a variable in Google
I have a transaction log file in CSV format that I want use to
I want to upload my application on google app engine and want to use
I want to upload a file. I use MVC3 with razor. I have the
I'm a excel file where i've Chinese content and i want to import them
My Quest:What data type should I use? I want to upload the gps data
I want to upload a file to net server use the codes. but when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.