Can a Submit button on a form go to an Excel spreadsheet


(Gab) #1

Hi - not sure if this can be done, but any help to point me in the right direction would be great.

 

We have a form that when the user clicks on the submit button, the information would automatically go into an excel spreadsheet.

 

The person who wants the info in the spreadsheet does not have access to the backend.

 

Cheers

Gayle


(Bart Banda) #2

You could do it so that it creates a CSV file after submit? That way you can open it in Excel afterwards. Is that what you are after?


(Peter McLeod) #3

Hi Gayle

 

We do the same as Bart suggested.

 

Would need to create a design asset to apply to the asset listing to set the correct mime type:

 

below is what we use but could also set as 'text/csv':

<MySource_PRINT id_name="__global__" var="content_type" content_type="application/vnd.ms-excel" />
<MySource_PRINT id_name="__global__" var="content_attachment" extension="csv" />
<MySource_AREA id_name="page_body" design_area="body" />

Also make sure there isn't any extra html added in the listed formats / body content.

 

Thanks

Peter


(Gab) #4

Excellent - will try and test. Thank you


(Gab) #5

Hi

 

Tested this page with a design asset. When the user clicks on submit, it opens up an excel file straight away as well as sending an email with the text entered.

 

Can the user not see the excel? Instead, the excel is sent to the manager in an email?

 

Do we have to use the design asset?

 

I thought it would be a simple tick  in the "Submit button" that would send the info as an excel document....


(Bart Banda) #6

So you don't want the user to see the CSV file? You still want them to see a HTML thank you page and you simply want to email the CSV file?

 

If that's the case, and if you are on a 5.2 version, you can use the Custom File Attachment feature on the Email Options screen to dynamically create a CSV file to attach to the email when it gets sent. 

 

https://matrix-manuals.squiz.net/custom-form/chapters/form-contents#email_options_screen