Skip to content

Conversation

@aadamgough
Copy link
Contributor

Summary

Creating a sheet in google drive didn't follow the proper syntax as it did for google sheets.

Type of Change

  • Bug fix

Testing

Tested with hummus

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Sep 28, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Sep 28, 2025 3:49am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Sep 28, 2025 3:49am

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Summary

Fixed Google Sheets creation by implementing proper Sheets API integration instead of relying on generic Drive API upload. Added https://www.googleapis.com/auth/spreadsheets scope and special handling for array data that uses the Sheets API to populate spreadsheet cells directly.

  • Added spreadsheets scope to oauth configuration
  • Implemented array content detection for Google Sheets MIME type
  • Added Sheets API integration to properly populate spreadsheet data
  • Maintained backward compatibility with fallback to original upload logic

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk
  • The fix correctly addresses the Google Sheets creation issue with proper API integration. Only minor null safety improvement needed on line 159.
  • No files require special attention

Important Files Changed

File Analysis

Filename        Score        Overview
apps/sim/tools/google_drive/upload.ts 4/5 Fixed Google Sheets creation by adding proper Sheets API integration and spreadsheets scope, with one minor null safety issue

Sequence Diagram

sequenceDiagram
    participant Client as Client/User
    participant Tool as Google Drive Upload Tool
    participant DriveAPI as Google Drive API
    participant SheetsAPI as Google Sheets API
    
    Client->>Tool: uploadTool.request(fileName, content, mimeType)
    Tool->>DriveAPI: POST /drive/v3/files (create file metadata)
    DriveAPI-->>Tool: fileId, metadata
    
    alt Google Sheets (application/vnd.google-apps.spreadsheet)
        Tool->>Tool: Parse content as JSON array
        alt Array data detected
            Tool->>SheetsAPI: PUT /v4/spreadsheets/{fileId}/values/Sheet1
            SheetsAPI-->>Tool: Success response
            Tool->>Tool: Mark handledAsSheet = true
        else Non-array content
            Tool->>Tool: Fall back to Drive API upload
        end
    else Other file types
        Tool->>DriveAPI: PATCH /upload/drive/v3/files/{fileId} (upload content)
        DriveAPI-->>Tool: Upload response
    end
    
    alt Google Workspace MIME types
        Tool->>DriveAPI: PATCH /drive/v3/files/{fileId} (update filename)
        DriveAPI-->>Tool: Name update response
    end
    
    Tool->>DriveAPI: GET /drive/v3/files/{fileId} (get final file data)
    DriveAPI-->>Tool: Final file metadata
    Tool-->>Client: GoogleDriveUploadResponse
Loading

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@vercel vercel bot temporarily deployed to Preview – docs September 28, 2025 03:46 Inactive
@waleedlatif1 waleedlatif1 merged commit 5ee6345 into staging Sep 28, 2025
4 of 5 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/google-drive branch September 28, 2025 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants