最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

react native - google sheets was unable to open your spreadsheet - Stack Overflow

programmeradmin3浏览0评论

Google Sheets Unable to Open XLS/XLSX in React Native App I am working on a React Native app that allows users to pick an Excel file (XLS/XLSX) and open it in Google Sheets using @react-native-documents/viewer. Steps to Reproduce 1️⃣ Install Dependencies npm install @react-native-documents/picker @react-native-documents/viewer 2️⃣ Create a React Native App with a File Picker and Viewer Below is my implementation:

import { viewDocument } from '@react-native-documents/viewer';

export const fileViewer = async (fileURI: string, title?: string): Promise<void> => {
  try {
    if (fileURI) {
      console.log('fileURI:', fileURI);

      await viewDocument({
        uri: fileURI,
        grantPermissions: 'read',
        headerTitle: title,
        presentationStyle: 'fullScreen', // iOS only
      });
    }
  } catch (error) {
    console.error('Error opening file:', error);
    throw error;
  }
};

File URI Example:

file:///data/user/0/com.xyz.abc/files/abc/_17624BDEF0BC42DA3B6551B1A4E9F2DE/_6DC3140B46DE1CC63C17A62D47391987/pdf/1074157.xls

发布评论

评论列表(0)

  1. 暂无评论