Let me ask you a question: Let’s say you have 15 excel files (or .csv) in a folder. How do you import them into Minitab?

Are you thinking in these steps?

  1. Go to File Open Worksheet
  2. Change the file type to Excel (or .csv or .txt)
  3. Browse for the file and click Open
  4. Repeat steps 1 to 3, 14 times! (one for each remaining file)

If you answered YES, you’re wasting your time!!!

There’s a quick and easy way to do this and it takes the same effort regardless of the number of files.

  1. Open the folder that contains the excel files
  2. Select the files you want to import ( If you want to select all files, you can press Ctrl + A. )
  3. Drag the files to the Session Window in Minitab

Minitab - Import several files in folder into Minitab

Pretty impressive, right?

Importing all files in a list with a macro

A more complex scenario is that you have a list of file names that you want to import. In this case again, there are three options

I hope that after reading this post you won’t use the completely manual approach anymore.

To solve this problem you can use the semi-manual approach or follow the next steps for a completely automated solution:

1 ) Paste the list of file names in Column C1 of any worksheet.

Minitab - File names in C1

2 ) Open this macro and modify the appropriate variables

Minitab - Modify macro variables

3 ) Save the macro in your Minitab Macro Folder. Make sure the file type is “All Files (*.*)

Minitab - Save macro

(*) Usually the Minitab Macro Folder folder is “C:\Program Files\Minitab\Minitab 16\English\Macros”, however, you can change the path for the macros folder in Tools Options General Browse for the Macro Location OK.

4 ) Press Ctrl + L to show the Command Line Editor, Type %OpenFiles, and press Submit Commands

Minitab - Submit Command

If you want to practice any of these methods, you can use your own files or you can download the following files:

  1. Zip Folder with 20 CSV files
  2. Zip Folder with 20 Excel files
  3. Excel files with the lists of file names

Enjoy!!!

In the next post, I’ll explain how to append the information of all the worksheets you’ve imported.

Subscribe to the mailing list to get notified when the next post comes out.

 

5 Responses

  1. Orlando, I like the why you write the macro , do you know how get the p-value for a Run Chart? Don’t use the graph info?

    1. Hi Juan,

      Unfortunately, that’s not possible since the Run Chart
      graph doesn’t have a storage option. With a storage option you could be
      able to save the p-values in a worksheet.

      I asked your question
      to the Minitab Technical Support team and they answered me that they
      logged this request to be considered for future versions.

    2. Hi Juan,

      Unfortunately, that’s not possible since the Run Chart graph doesn’t have a storage option. With a storage option you could be able to save the p-values in a worksheet.

      I asked your question to the Minitab Technical Support team and they answered me that they logged this request to be considered for future versions.

  2. I saved the macro in the located as indicated above, but when I ran the macro it gave me this error message:
    * ERROR * Undefined variable, illegal column or stored constant at X.
    * ERROR * Completion of computation impossible.
    I am using MINITAB14 importing an .xls file. Would this make a difference?

Leave a Reply

Your email address will not be published. Required fields are marked *