Allow the ability to associate a webform with a google spreadsheet. Like so: http://googlesystem.blogspot.com/2008/02/add-data-to-google-spreadsheets...

Comments

quicksketch’s picture

Status: Active » Closed (won't fix)

This doesn't seem like something that should be integrated with Webform (at least directly). This sort of behavior is possible by creating a separate module that is dependent on Webform, but the amount of code it would take to gracefully integrate the two would warrant it being it's own module rather than part of the default Webform package.

charlie-s’s picture

Version: » 6.x-3.6

I'm pledging to create this functionality in a separate module. After a lot of thinking I have concluded that Webform is the best approach for a client's customers to fill out applications on their website, and the results *must* go into their multi-user managed Google Docs account.

I have done this myself outside of Drupal, so the methods are not foreign to me, but integrating it into Webform as an add-on is the next step.

If anyone has interest in this topic post here, otherwise I will just post my results when I can.

patoshi’s picture

hi csdco! sounds like a perfect feature that would help businesses that use gdocs spreadsheets alot. right now i run an electronics repair shop and mainly operate on google docs, but it can only go so far. would be great if the webform can populate a gdocs spreadsheet.

sinuz’s picture

This feature would be very nice! Any progress on it?

charlie-s’s picture

I had begun some work on this only to realize, in discussions with the client, that Webform will not meet their needs; some of the data captured will need to go to Google Docs and some data will need to go into their CRM. Thus, it makes more sense to continue using a custom form and PHP script to process them that will perform these tasks. I can't justify higher costs to re-develop a platform that currently works for them.

Ultimately, I wanted to see this accomplished in a generic module that would allow users to dynamically map their Webform components to spreadsheet fields. Until that day, you can do something like this:

- download Zend Gdata library (http://framework.zend.com/download/gdata)
- hook into Webform's submission API and run a function like this on your form's submission:

<?php
require('google-spreadsheet.inc.php'); // Zend Google Spreadsheet class
set_include_path(get_include_path() . PATH_SEPARATOR . "$_SERVER[DOCUMENT_ROOT]/Zend"); // Zend library include path
$spreadsheet = new Google_Spreadsheet('your-gdocs-username','your-gdocs-password');
$spreadsheet->useSpreadsheet($template['google_spreadsheet']); // Specify the spreadsheet name here
$spreadsheet->useWorksheet($template['google_worksheet']); // Set the worksheet name here. If you don't set this, "Sheet1" is assumed.

// Add your form data to a new array to be inserted, perform this task however you need. 
$google_row = array();
foreach ($your_form_data as $key=>$value) {
  $google_row[$key] = $value; // This only works if the $key (or field "name") is identical to the column header in your Spreadsheet
}

// Add your data as a new row in the spreadsheet
$spreadsheet->addRow($google_row);		
?>
charlie-s’s picture

I'm actually interested in picking this idea back up... Is anyone willing to help out with the code?

charlie-s’s picture

You can get a working copy of this module here: http://drupal.org/project/webform_to_gdocs

Initially it's only working with spreadsheets but I (or others) may introduce other document types.