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