Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to export data to a file using a SaveAs type dialog, using something like FileNameSetter[name,"Save"] to give a browse button.

Any help with this would be greatly appreciated. It is very possible that I have simply misunderstood the documentation.

Many thanks, Christina

share|improve this question
up vote 8 down vote accepted

SystemDialogInput["FileSave"] will do this for you.

Something like

fileName = SystemDialogInput["FileSave"]
If[fileName != $Canceled, Export[fileName, myData]]

should do the whole trick. The fire extension determines the type of export (if MMA knows it and supports it).

Preselecting a directory path and filtering allowable file extensions can be done as follows:

                      "JPEG" -> {"*.jpg", "*.jpeg"}, 
                      "Portable Network Graphics" -> {"*.PNG"}
share|improve this answer
Thank you. I found that Save[SystemDialogInput["FileSave"],data] allows me to save data to a file. – Christina Jun 7 '12 at 21:12
@Christina Save is fine if you just want to save some Mathematica symbols to be read in again by Mathematica. If you want to save data in a more structured and exchangeable format Export is usually the first choice. – Sjoerd C. de Vries Jun 7 '12 at 21:29
Thank you for all the help. It works perfectly now. – Christina Jun 11 '12 at 13:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.