GoogleDrive

Drive Operations

UploadTo uploads a local file (set with WithLocalFile) to Google Drive using the provided filename. SaveTo downloads a Drive file (targeted with WithFileId) to a local GPALFile. MoveTo moves a file to a different folder by folder ID. RenameTo renames the file - set the new name with WithFileName before calling. DeleteFile removes the targeted file from Drive. ListFiles retrieves a collection of files as an out IGPALGrid<string> containing file IDs and names.

Examples

GPAL Fluent: High-level fluent C# API

//RenameTo() uses the name set by WithFileName - call WithFileName before RenameTo in the chain. MoveTo takes a folder ID string - not a folder name; use ListFiles to find folder IDs.

// Upload a file to Drive

GPAL.GoogleDrive

.WithCredentials(googleCreds)

.WithLocalFile("C:\reports\q4.pdf")

.UploadTo("Q4-Report-2026.pdf");


// Download a file from Drive

GPAL.GoogleDrive

.WithCredentials(googleCreds)

.WithFileId("1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgVE2upms")

.SaveTo("C:\Downloads\report.pdf");


// List files in Drive

GPAL.GoogleDrive

.WithCredentials(googleCreds)

.ListFiles(out var files);


// Rename a file

GPAL.GoogleDrive

.WithCredentials(googleCreds)

.WithFileId("fileId")

.WithFileName("new-name.pdf")

.RenameTo();

💬 Ask GPAL