new 'Spreadsheet data store'. Not working ?

2 views (last 30 days)
Simon Parten
Simon Parten on 10 Mar 2016
Answered: Aaditya Kalsi on 10 Mar 2016
We read a lot of spreadsheets. Spreadsheet datastore looked good. Sadly, it doesn't appear to work for me ...
My spreadsheet reads this;
raw = spreadsheetDatastore(filename);
rawData = read(raw);
Unfortunately, that gives me this answer;
Error using matlab.io.datastore.SpreadsheetDatastore/read (line 90)
Unable to convert variable 'PERSPVALUE' in sheet 'descr' in file
'G:\Investment_Management\Transactions\Non_Life_New\Chubb\2016\GlobPropCat\ANALYSIS\PRICING\data\Chubb2016_PROFORMA_1a_INTL.xlsx'
to type 'double'
There is no cell with the value 'PERSPVALUE' in sheet descr. There is a column with that name as the header in sheet 'oeps'. I am unclear on either the purpose or correct usage of the spreadsheetdatastore, and sadly unable to make out what the correct usage would be from the documentation.
I also cannot post the spreadsheet online.
Has anyone had success with this function that they could share? Simon
  1 Comment
Walter Roberson
Walter Roberson on 10 Mar 2016
Some cell in the column named PERSPVALUE could not be converted to double() . For example the column might have text (that does not look like a number). Times can be a problem, depending on which time format they were stored with in the spreadsheet. Charts and graphs would be a problem. I do not know if empty cells would be a problem.

Sign in to comment.

Answers (1)

Aaditya Kalsi
Aaditya Kalsi on 10 Mar 2016
I would try setting
raw.NumHeaderLines = 1;
to skip that header row. If there are more, I would tweak that variable.
If all else fails, you could manually specify the Range property as:
raw.Range = 'B2:L1000';
Hope that helps.

Products

Community Treasure Hunt

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

Start Hunting!