How to import data from .txt into Excel workbook?
Show older comments
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
dpb
on 16 Jun 2014
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.
KALYAN KUMAR
on 11 Nov 2014
for multiple text files what should we do??
KALYAN KUMAR
on 11 Nov 2014
for single text file it is ok but for more than 100 text files to be converted what should i need to do??
Answers (1)
Joseph Cheng
on 16 Jun 2014
0 votes
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.
Categories
Find more on Spreadsheets in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!