Skip to content Skip to sidebar Skip to footer

Which MIME Data Type For Android Excel CSV?

I tried 'text/csv' and even 'application/vnd.ms-excel', but Excel won't show in the list of choices. Plenty of other apps do. void shareCsv(Uri uri, Context context) { Intent

Solution 1:

It should be application/vnd.ms-excel (source)


Solution 2:

You can try:

void shareCsv(Uri uri, Context context) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_SEND);
    intent.setType("application/excel") //replace "text/csv" with application/excel
    intent.putExtra(Intent.EXTRA_STREAM, uri);
    intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);

    context.startActivity(intent);
}

Here's a link to the .xls mime-types you can use. If one type isn't working for you, try another.

List of choices for Excel:

  • application/excel
  • application/vnd.ms-excel
  • application/x-excel
  • application/x-msexcel

Post a Comment for "Which MIME Data Type For Android Excel CSV?"