Forums

csv mail to admin

janman 27 Oct, 2016
Hi Support
I would like to email a 3rd party company a csv email attachment of fields completed.
Any help will be greatly appreciated
Thanks,
janman 27 Oct, 2016
Hi Support
Got it working
i used the csv export to export all data from db table and then attached the file using custom code

<?php
$files = array(
  'userdata.csv'
);
$path ='mypath';
foreach ( $files as $k => $f ) {
  $form->files['files_to_send'][$k]['path'] = $path.$f;
}
?>

I then receive all the data captured in the csv as a mail attachment

What i would like to know, if it is possible to capture only the last row or the last record captured in the db table and then attach that csv in mail
Thank you.
GreyHead 27 Oct, 2016
Hi janman,

Yes, you can do that - but what practical use is it?*

You can use the Data Path option in the CSV Export action to select data from the current form - you can pick this up after the DB Save action has run.

Bob

* The neater way to do this may be to use the GSheet export action which will add the latest record to the end of the GSheet.
This topic is locked and no more replies can be posted.