Getting Google spreadsheets as Excel using C #

I believe the following steps I should take:

A) I need to send the following login details:

POST / accounts / ClientLogin HTTP / 1.0 Content-type: application / x-www-form-urlencoded

AccountType = HOSTED_OR_GOOGLE & Email=jondoe@gmail.com & Passwd = north23AZ & service = class & source = Gulp -CalGulp-1.05

B) It is necessary to check the return code

C) If it returns a success code, I need to download the spreadsheet in the following example URL: http://spreadsheets.google.com/fm?key=DOCUMENT_ID&fmcmd=4&hl=en

How can I perform the above operations in C #?

Editorial: I did this before entering the system. The return flow is something similar. I am not sure how to load excel sheet using this. Any hint would be very helpful.

The response stream is as follows:

SID = DQAAAIcAAADFWSVJV-6__fb211rhQLHU_jCQ1sKElh-qOf7V10WI1PUQsKmuTdPD2DEWGdbspK2h7DFxH7DPwDIQaTt1RGhwxSq9isqkmlFgcyX8nu7EotpwOfAnyGrD9mL4N vOVq4MM0FfRWVNlOn64wNM3W4tN0DTN5mLx1_jYHVD5png7esvwneScOSf6wEXGoQfsw5E LSID = DQAAAIkAAACzE9S9RdLtuCl6gfbWn9CKn4nhCdAmW4d0yLp4ypT2In769POcAsQBKiQ-VLH1Y194EuqIVrYoQTphK0Na2GQf_DWwHmXSyToZoqIh2c5GVXA0k_0IH8j745GjzLEqLpVmH2oJFNxOJYpu02If 5O8Wd1x99AsxJ35rz1OHDq_XlDBW4192pReV7SQxSf7z4-4 Auth = DQAAAIkAAACz5fRdLtuCl6gfbWn9CKn4nhCdAmW4d0yLp4ypT2In769POcAsQBKiQ-VLH1Y1-g-zsSlAXwWMwUNufqHku2F5LoAxLIElcF4aLcnQYVGs7xKNX9XlCgwubHkw7sYm4aEnjpLp0Fpmyb_paP_BABWQ ahpM5oyWob5f4KfoLFC7ltcFAVjgJjXsAAjHkToUg

EDIT: This is the request header captured by FireBug: (I do not understand some of these parameters for creating an HTTP request in C #) Pls help.

Host

spreadsheets.google.com

User agent

Mozilla / 5.0 (Windows; U; Windows NT 5.1; en-US; rv: 1.9.0.10) Gecko / 2009042316 Firefox / 3.0.10 (.NET CLR 3.5.30729)

To accept

text / HTML, application / XHTML + XML, application / XML; d = 0.9, /; d = 0.8

Accept language

en-nam, en; d = 0.5

Accept-encoding

Gzip, deflate

Accept-charset

ISO-8859-1, UTF-8; d = 0.7, *; d = 0.7

Keep-alive

300

Proxy connection

keep active

Cookie

PREF = J = 090597c918ef0061: TM = 1245011295: LM = 1245011295: S = qs8OO7D02yy9tKj8; RememberMe = false; SID = DQAAA IUAAAAi0iAuzneHzKleShR4itA8-zGxSKw6hqf8qBHBHJBLbNpynNOon7Ni96C4ckRcVVC5Wt89K8PywrKK5qjTmscrqizfWHygV _nPssvw5uOL9IcEWpa5aqUfeQyk-vsEMHYjLe9Ko0i2pAJrQxBrNFii588ucAVtyNoSrZVzAtZADXhhywHUK8x-LezoUaHiEbM

0
source share
3 answers

Another thing to consider is Fiddler:

http://www.fiddler2.com/fiddler2/

Use it to get an idea of ​​the interactions between your browser and Google when you download the spreadsheet β€œnormally”, and then encode your application to simulate it.

+1
source

It looks like the SID is the session identifier, which is supposedly a cookie, which you should send back to the next POST / GET.

0
source

Not difficult: download the Google SS API API and see a sample code - it will connect you to your Google documents, and you can easily transfer data to Excel if you built it as adding VSTO in Visual Studio - did it yourself in one day, but it wasn’t would be inclined to publish code with "no work" in the first place.

0
source

Source: https://habr.com/ru/post/1285658/


All Articles