I am trying to import data from a file. If I import a CSV file, I get:


For example, two curly brackets.

If importing from a .xlsx file I get an extra curly bracket like:


Why does this happen?



Import["file.csv"] imports a CSV file, returning an array.



Import["file.xlsx"] imports all sheets of an XLSX file, returning the result as a list of arrays.

If the file contains a single sheet, you can eliminate the extra curly braces using the second argument of Import as in @bobthechemist's answer, or simply using Part:

| improve this answer | |
  • $\begingroup$ I need to buy a new keyboard that doesn't have sticky keys; might have beaten you... $\endgroup$ – bobthechemist Mar 7 '15 at 22:49
  • $\begingroup$ @bob, speaking of sticky keys -- only a few of the keys on my laptop are working due to a coffee spill; and my external keyboard happens to be our cat's favorite spot, and hence full of cat hair:) $\endgroup$ – kglr Mar 7 '15 at 22:53
  • $\begingroup$ Thanks both. The learning curve is a killer with Marhematica! But makes sense once explained. $\endgroup$ – David Kerr Mar 8 '15 at 4:19

As mentioned in the comments and the documentation, importing from Excel files allows for multiple sheets. Thus, a single-sheet file will have what you refer to as an "extra" pair of curly braces. To eliminate this behavior, use:


The above command will import just the first datasheet.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.