에서 Excel 파일을 업로드하는 방법 C#을 사용하여 Google 문서에 Excel 파일을 업로드하고 싶습니다. 구문을 사용 노호 XLS 파일Google 문서
//use Content-Type: text/csv
entry.MediaSource = new MediaFileSource("E:\\Emailcontent.xls", "text/csv");
를 업로드하지만 내가이 conversion.I 그냥 내 구글 doc.Help 내 엑셀 파일을 업로드 할 싶지 않아 나누었다을 CSV로 업로드 파일 변환 후, 작동하지 않습니다 변환없이 엑셀 파일을 업로드 할 수 있습니다. 진보 된 감사의 말씀
string USERNAME = "[email protected]";
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());
앞으로는 질문을 올리기 전에 먼저 API를 읽는 것이 좋습니다. 나는 때때로 붙어서 잘못된 솔루션을 찾는 것이 쉽지만, 게시하기 전에 몇 가지 조사를하면 쉽게 해결할 수 있다고 생각합니다. 확실히 두통을 덜어 줄 것입니다! :) – Tom