Reading multiple excel files with data store when the columns of the files change position
Show older comments
Hi. I am trying to read hundreds of excel files with data store, but the files vary the position of the columns. Data Store reads the position of the columns in the first file and assumes that it is the same for the rest. when reviewing the data of the last excel files does not match, because its position was different. how do i solve it?
thanks.
2 Comments
Guillaume
on 31 Oct 2019
Unfortunately, it's not something that's supported by the SpreadsheetDatastore. In theory, you would have to write your own custom datastore to handle this but it would be a lot of work.
However, have all the files got the exact same columns just in different position? If so, you could handle it with a TransformedDatastore. If you can attach two sample files (actual content can be rubbish as long as they've got the correct format), I can show you how to do that.
Juan Carlos Pozuelos Buezo
on 31 Oct 2019
Accepted Answer
More Answers (1)
Roofus Milton
on 31 Oct 2019
0 votes
I would use a cell array populated by readtable then simply reference the colums by name.
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!