OpenWhisk serverless PHP action to store data from an HTML form into Google Sheets.
-
Install the Serverless Framework
$ npm install --global serverless serverless-openwhisk
-
Set up IBM Cloud Functions and log into the correct organisation and space. Ensure you can run:
$ wsk api list
(This will ensure that the
~/.wskprops
file is up-to-date; it contains the relevant API keys that are used by Serverless when deploying.) -
Clone this repo(!)
-
Run the package manager:
$ npm install
-
Set up the Google Sheet as per David McCoy's article
-
Set the SHEETS_URL environment variable to the URL:
$ export SHEETS_URL=https://script.google.com/macros/s/{stuff}/exec
-
Deploy the API using the
sls
command:$ sls deploy
-
Prove it works:
$ curl "https://openwhisk.eu-gb.bluemix.net/api/v1/web/YOUR_NAMESPACE/ow-php-form-to-google-sheets/submit.http" \ -d "firstname=Rob" -d "lastname=Allen" -d "email=rob@example.com"
There should now be a new row in the Google Sheet.
- Google Sheets integration from David McCoy's article.