How to import data from .txt into Excel workbook?

Hello,
I have several text files with data that needs to be put into an Excel workbook. Each text file will go into a new "sheet" within the same workbook, and no editing will be done to the data. I am new to MATLAB and programming in general, so I am looking for the simplest way to do this. Thanks in advance for your help.

3 Comments

If you've got to do it in Matlab, depending on what the file format is, the simplest is probably
doc importdata
doc xlswrite
Specifics would depend as mentioned on just what the file structure actually is.
for multiple text files what should we do??
for single text file it is ok but for more than 100 text files to be converted what should i need to do??

Sign in to comment.

Answers (1)

What type of data is within the text file? No matter what it is you can use xlswrite() function to perform what you want. Now how to do this all depends on what the information within your text files are. Text+numbers, Just numbers, different tables with different column and row variation.
If it just contains numbers in rows and columns you can read in the data with dlmread for deliminated. Or if there is some funky formatting perhaps line by line and parsing it out to cells in excel.

Products

Asked:

on 16 Jun 2014

Commented:

on 11 Nov 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!