通过API在我的Android应用程序中查看Excel文件

我想在我自己的Android应用程序中查看excel文件。

目前,使用我的应用程序,我可以看到所有的谷歌文档。 但是,点击任何一个文档(例如Excel文件'myDemo.xls')后,我想打开它在我自己的应用程序(用于查看目的)。

我已经阅读了关于jxl,但与此问题是,它parsingxls文件和文件应存储在SD卡。

在我的情况下,它存储在谷歌驱动器。 (不在SD卡上)

这是类似的问题。

有没有其他的方式来通过任何其他API查看xls文件。

任何帮助将不胜感激。

谢谢

我已经使用WebView来实现这一点。

但问题是,通过使用webview我无法更新谷歌文档。

我想用户通过webview使用我的应用更新谷歌文档。

下面是我到现在为止尝试过的代码,

MainActivity.java

public class MainActivity extends ActionBarActivity { WebView wbView1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); wbView1=(WebView)findViewById(R.id.webView1); wbView1.getSettings().setLoadsImagesAutomatically(true); wbView1.getSettings().setJavaScriptEnabled(true); wbView1.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); wbView1.getSettings().setBuiltInZoomControls(true); wbView1.getSettings().setSupportZoom(true); wbView1.getSettings().setAllowContentAccess(true); wbView1.setWebViewClient(new MyBrowser()); } // Button on clicking on which I am loading google docs url in WebView. public void onButtonClick(View v) { wbView1.loadUrl("https://docs.google.com/spreadsheets/d/15L4VenowOI0WPO52ASSjRgf90LcNxuJg8VF87_DtTp8/edit#gid=1311977634"); return; } public class MyBrowser extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } @Override public void onPageFinished(WebView view, String url) { view.loadUrl("javascript:document.forms[0].q.value='[android]'"); } } } 

activity_main.xml中

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.example.webviewdemo.MainActivity" tools:ignore="MergeRootFrame" > <WebView android:id="@+id/webView1" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight=".4" android:clickable="true"/> <Button android:id="@+id/button1" android:layout_width="match_parent" android:layout_height="wrap_content" android:onClick="onButtonClick" android:text="Button" /> </LinearLayout> 

AndroidManifest.xml中

 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.webviewdemo" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.INTERNET"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="com.example.webviewdemo.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> 

可以在WebView内编辑Google文档,还是需要Google Drive API来编辑文档?

我真的很困惑。 请帮助。