Java Android打算在电子表格中打开CSV

Java Android打算在电子表格中打开CSV,java,android,android-intent,Java,Android,Android Intent,我正试图打开一个CSV文件到谷歌工作表,但我不能 这一切工作正常,我可以保存我的CSV到谷歌驱动器,然后打开它从驱动器,但我想直接打开到谷歌表 可能吗 Intent shareIntent = new Intent(); Uri contentUri = FileProvider.getUriForFile(activity.getApplication(), activity.getApplication().getPackageName(),

我正试图打开一个CSV文件到谷歌工作表,但我不能

这一切工作正常,我可以保存我的CSV到谷歌驱动器,然后打开它从驱动器,但我想直接打开到谷歌表

可能吗

Intent shareIntent = new Intent();

        Uri contentUri = FileProvider.getUriForFile(activity.getApplication(),
                activity.getApplication().getPackageName(), file);
        activity.getApplication().grantUriPermission(activity.getApplication().getPackageName(),
                contentUri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
        shareIntent.setData(contentUri);
        shareIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
        shareIntent.setAction(Intent.ACTION_SEND);
        shareIntent.putExtra(Intent.EXTRA_STREAM, contentUri);
        shareIntent.setType("text/csv");

        activity.startActivity(Intent.createChooser(shareIntent, "Abrir CSV"));

提供者:

<provider
        android:name="android.support.v4.content.FileProvider"
        android:authorities="${applicationId}"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/file_paths" />

xml/文件路径:

<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-cache-path name="external_files" path="."/>
</paths>


提前感谢大家

将mime类型设置为
text/*
,工作表就会显示出来


另外请注意,在
setData
之后调用
setType
实际上会将数据设置为
null

嗯,在Google获得一份工作,安排在Google Sheets团队中工作,并将该功能添加到Google Sheets中,以允许其打开CSV文件,我想。可以使用工作表打开CSV,我可以手动操作,用手指点击google drive:d上的csv文件并不意味着google向第三方开发者公开了该功能。