GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - G0gix/GoogleAPI-Library: Library that allows you to interact with google services

BranchesTags
Open more actions menu

Latest commit

 

History

4 Commits
4 Commits

Folders and files

NameName
Last commit message
Last commit date
GoogleAPI-Library
GoogleAPI-Library
 
 
.gitignore
.gitignore
 
 
GoogleAPI-Library.sln
GoogleAPI-Library.sln
 
 
README.md
README.md
 
 

Repository files navigation

GoogleAPI-Library

This library is an add-on to the existing library from Google, which allows you to interact programmatically with various Google services, such as Google Drive, Google Sheets

The goal of this project is to make it easier to interact with Google services, and to reduce code duplication in projects where interaction with Google is required.

⚠️ Not full functionality

Library functionality is added as needed. Because of this, the library does not implement all of the available functionality.

Google services used:

  1. Google Drive
  2. Google Sheets

🚀 How to use

Currently, the library provides two classes for interfacing with Google services:

GoogleDriveManager drive = new GoogleDriveManager(DriveService);
GoogleSheetsManager sheets = new GoogleSheetsManager(SheetsService);

Every class that interacts with Google takes a descendant of the BaseClientService class in its constructor

For Drive API this is DriveService, for Sheets API SheetsService

Google Sheets

GoogleSheetOptions options = new GoogleSheetOptions
{
  SheetId = "Your Sheet id",
  SheetRange = "Your Sheet Name"
};

// Reading data from Google Sheet
GoogleSheetsManager googleSheetsManager = new GoogleSheetsManager(SheetsService);
var data = await googleSheetsManager.ReadAsync(options);

// Writing data into Google Sheets
var dataToInsert = new List<IList<object>> { new object[] { "data", "data2", "data3" } };
await googleSheetsManager.WriteAsync(options, dataToInsert);

Google Drive

Get subfolders in the main folder:

string mainFolderId = "Your main folder ID";
GoogleDriveManager manager = new GoogleDriveManager(DriveService);
List<FolderModel> folders = await manager.Folders.GetFolders(mainFolderId);
 
foreach (FolderModel folder in folders)
{
  Console.WriteLine($"name {folder.Name} id: {folder.Id}");
}

Add Permissions to Folder:

GoogleDriveManager manager = new GoogleDriveManager(DriveService);
await manager.Permissions.AddUserToFile(PermissionRole.writer, PermissionsType.user, "[email protected]", "Folder ID", false);

To use the Service account for Google Drive:

GoogleCredential credential = GoogleCredential.FromFile(SecretPath).CreateScoped(DriveService.ScopeConstants.Drive);

DriveService service = new DriveService(new BaseClientService.Initializer()
{
  HttpClientInitializer = credential,
  ApplicationName = AppName
});

🤝 Contributing

Contributions, issues and feature requests are welcome. Feel free to check issues page if you want to contribute.

About

Library that allows you to interact with google services

Topics

csharpgooglegoogle-apigoogle-drive-api-v3google-sheets-api-v4

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.