开发者

How to post data from an EXCEL Userform to a Google form with a spreadsheet at the backend?

开发者 https://www.devze.com 2023-03-23 12:16 出处:网络
I have a problem that I\'ve been looking to solve, but so far no one has been able to help me. I have an excel file, that I will distribute amongst colleagues. They will open it, and enter 5 fields:-

I have a problem that I've been looking to solve, but so far no one has been able to help me.

I have an excel file, that I will distribute amongst colleagues. They will open it, and enter 5 fields:-

Name, Delivery Address, Cell Phone Number, Email Address, and Amount Payable.

Once done, they will verify the values that will be displayed in a filled userform (i.e. values will be picked from the excel cells that have been filled).

I want that once the submit button is clicked, the userform uses a POS开发者_StackOverflowT function to populate the spreadsheet that is available at my google docs page.

Now I know that this is possible, since people have been accessing the google form via a POST function. See here: http://asynclabs.com/forums/viewtopic.php?f=16&t=489

Could somebody be kind enough to help me out?

Thanks!


The best way to do a HTTP POST from Excel VBA is probably to use MSXML.

Add a reference to "Microsoft XML, v3.0", use like the following example VBA code:

Dim httpRequest as XMLHTTP
Set httpRequest = New XMLHTTP

' ... False means execute request synchronously
httpRequest.Open "POST", "https://spreadsheets.google.com/...", False
httpRequest.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
httpRequest.send "entry.0.single=<DATA1>&..."

' ... after the .send call finishes, you can check the server's response:
httpRequest.status
httpRequest.statusText
httpRequest.responseText
httpRequest.responseXML

MSDN documentation

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号