I’ve been writing a perl cgi script to populate a Google spreadsheet, using LWP, the spreadsheet list-based feeds, and the model outlined in the Google article “Using cURL to interact with Google Data Services“.
Everything was working fine until I had an html form with some multiline textarea input fields.Â I wanted multiple lines of user input to go into a single cell in the Google spreadsheet.Â When you’re manually entering data into a Google spreadsheet, you just use ctrl-enter to move to the next line inside a cell.
Some documentation said to put a linefeed (ascii 10, or “\n” in perl) between the lines, and it really is that simple.Â Where I got hung up was in thinking that I already had a linefeed in the form field.Â It turns out that I had carriage return + linefeed, which the Google spreadsheet API doesn’t like.Â All you have to do is strip out the carriage return (“\r” in perl) and it will work fine.
I might not have had this problem with browsers running on Mac or linux, but I’m primarily dealing with browsers on Windows.
Sounds interesting. I guess I need to hear the use case though to get a vision for how I could use this.
Good point. We’re using a web form to collect information about concerts. We wanted several fields (like “quotes from hosts”) to allow for several lines of input, but we want all of those lines to go into a single Google spreadsheet cell.
It would have been easy with a Google Form, but we also wanted more styling options for the form, and possibly other submit actions in addition to populating the Google Doc. So, we needed a custom form processor that can also handle appending data to a Google Doc.