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.