Forums

Google Save

mduda 28 May, 2016
Hi Bob,

Is there any work-around that you can find for this?

I use CB, and there are some fields that use an underscore (i.e. "cb_phone"). I have my form connecting and dumping into a google sheet. All other fields populate except the field with an underscore. Any way around this without renaming the field? Would be a huge hassle to do it, and figured if there is a way, you might be able to come up with it🙂
GreyHead 29 May, 2016
Hi mduda,

I've not seen this before - do the Google docs suggest any limits on using underscore in names?

I found one suggestion that the Google API strips out the underscore so that the column name becomes cbphone. Can you test adding a cbphone column to the sheet?

Bob
mduda 29 May, 2016
Good idea...just tried renaming the field to cbphone in google sheets, but the data didn't pass through. 😟
GreyHead 30 May, 2016
Hi Mduda,

I got it to work with a column named cb_phone by adding this in a Custom Code action before the GSheet Save action:
<?php
if ( !empty($form->data['cbphone']) ) {
  $form->data['cbphone'] = $form->data['cb_phone'];
}
?>
It looks as though Google ignores spaces and underscores in column titles for data transfer purposes so cb_phone, cb phone and cbphone are all treated as cbphone . . . except that if there is more than one then the later ones are numbered so they become cbphone, cbphone_2, cbphone_3

Bob
mduda 31 May, 2016
Awesome🙂 Unfortunately I'm still not able to get the data for the field to pass through. I added the model GSheet, and that did not work. What am I missing? I'll play with it some more when I return from holiday!
mduda 17 Jun, 2016
Hmmm. Been trying to get this to work. Did you name the column cb_phone in your google sheet? Still can't get the data to pass through. This is the code with GSheet as model. The custom code is located before the gsheet save action. What am I missing?
    <?php
    if (!empty($form->data['GSheet]['cbphone']) ) {
      $form->data['GSheet']['cbphone'] = $form->data['GSheet']['cb_phone'];
    }
    ?>
GreyHead 17 Jun, 2016
Hi mduda,

Yes I do have the GSheet column called cb_phone. I didn't use a Data Path in my test but that shouldn't make a difference.

Bob
mduda 17 Jun, 2016
Got it to work! Named the column in the google sheet cbphone

Tweaked code to:
    <?php
    if ( !empty($form->data['GSheet']['cb_phone']) ) {
      $form->data['GSheet']['cbphone'] = $form->data['GSheet']['cb_phone'];
    }
    ?>
This topic is locked and no more replies can be posted.