Menu

Format the email data for copy and paste

Help
Robbie
2010-11-17
2013-06-03
  • Robbie

    Robbie - 2010-11-17

    Thanks for a great form!

    Is there a way to format the data in the email body so that one can copy and paste it into a spreadsheet and, for example, "Name: John" will fall into two columns? I ask because I'm doing this for a friend who's technically-challenged and would like a solution where he can get and use the data on his own. The database option is not feasible, using ftp to get the .dat file is not simple for him, and unformatted data in an email body means time to copy and arrange it in a spreadsheet.

    I'm open to any other ideas.

    Cheers,

    R

     
  • TNTEverett

    TNTEverett - 2010-11-17

    There is a section of the processor.php that looks like this:
    mail("info@url.com","phpFormGenerator - Form submission","Form data:

    Name: " . $_POST . "

    Where each line is a line sent in the email.  Change this to be whatever you want.  If you simply want to cut and paste to Excel the easiest way is to cut and paste into a text file first then open the file with Excel and specify the "space" character as the delimiter.  This way no changes to the form are required. 

     
  • Robbie

    Robbie - 2010-11-17

    I found it one step quicker to copy the email text and then paste-special into the spreadsheet with "Space" chosen as the Separated By option.

    To make this work, I adjusted the field names in processor.php. Example-

    First name: " . $_POST . "

    became

    First_name: " . $_POST . "  

    Thanks!

     
  • Robbie

    Robbie - 2010-11-17

    I should add that the above worked with OpenOffice Calc, which my friend uses. I tried it with Excel and don't see the paste-special option of choosing the separation, though it did work your way of first creating the text file and then opening it with Excel.

     
  • Robbie

    Robbie - 2010-11-17

    And then I realized the above is only good if one wants to make a file out of just one set of data. To save everything in one spreadsheet,  I created one for my friend with labels- Last name, First name, etc.- down the side (the A column). Then I changed the processor.php file to this-

    " . $_POST . "
    " . $_POST . "
    " . $_POST . "
    etc.

    so that the data in the email body comes out as

    Smith
    John
    212-555-1234
    etc.

    Then he simply copies and pastes it into the top of the B column and it all falls perfectly into place (no need for Paste-Special). Then the next set into C, D…etc.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.