Minitab

2 easy ways to import files from a folder into Minitab

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

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

  • Completely Manual: Import the files one by one
  • Semi-manual: Go to the folder, manually select the files in the list, and drag them to the Session Window in Minitab.
  • Automatic: Paste the list in Minitab and use a macro to import them automatically.

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.

2 ) Open this macro and modify the appropriate variables

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

(*) 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

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.

 
Orlando Mezquita

Love helping out people to get better using data analysis tools! My day job is statistician for a Pharmaceutical Company.

View Comments

  • 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?

    • 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.

    • 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.

  • 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?

Share
Published by
Orlando Mezquita
Tags: MacroMinitab

Recent Posts

18 courses to learn R in 2018

Do you want to learn or get better at R programming?  If yes, you will…

7 years ago

Calculating the median in Excel PivotTables

Go to Master Data Analysis Yes, you read the title of this post correctly, you…

7 years ago

Using R to predict if a customer will buy

In this post, I’ll show how to create a simple model to predict if a…

8 years ago

Data Science for Beginners

Are you wondering what's all this buzz about data science? The following videos will give…

8 years ago

Import excel files with a dynamic starting row

Go to Master Data Analysis This is the 4th post of a series that covers…

8 years ago

Import specific cells from Excel files

Go to Master Data Analysis This is the 5th post of a series that covers…

8 years ago