convert xlsx to csv
Show older comments
Dear all,
I have an .xlsx excel file and I am using Matlab2011 to transform it to an csv.file so as to be able to import this excel file as it is (that is, with the same structure) into Stata
The excel files has a structure similar to the example below
A={ 'Name1' 'Name2' 'Name_3' 'Name_4'
'AQ' '100_HOE_rev' 'TTT' [ 0]
'AQ' '100_HOE_rev' 'TTT' [ NaN]
'AQ' '100_HOE_rev' 'TTT' [ 345,8] };
I tried something like
path = NameFiles('D:\Cart_er_1.xlsx');
xlsx2csv(path)
but I get the following error
Transforming the xlsx file: D:\Cart_er_1.xlsx
Error using
Interface.Microsoft_Excel_14.0_Object_Library.Workbooks/Open
Invoke Error, Dispatch Exception:
Source: Microsoft Excel
Description:
'D:\Cart_er_1.xlsx'
could not be found. Check the spelling of the file
name, and verify that the file location is correct.
If you are trying to open the file from your list of
most recently used files, make sure that the file has
not been renamed, moved, or deleted.
Help File: xlmain11.chm
Help Context ID: 0
Error in xlsx2csv (line 20)
Workbook = Excel.WorkBooks.Open(pathxlsx);
Is there any other way to do this conversion?
Thanks
Answers (1)
Ryan Livingston
on 19 Feb 2013
0 votes
You could just save it as a CSV in Excel:
7 Comments
antonet
on 19 Feb 2013
antonet
on 19 Feb 2013
Oleg Komarov
on 20 Feb 2013
Yes you can, but IMO MATLAB is a bit of an overkill and you should be quicker off using a specific tool.
antonet
on 20 Feb 2013
Ryan Livingston
on 22 Feb 2013
IMO is an acronym for In My Opinion
Sean de Wolski
on 22 Feb 2013
It'd be pretty quick in MATLAB, a quick for-loop over the files xlsread/csvwrite, done...
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!