This repository is archived. Support for this program will be as is and will no longer be supported and updated. The program will stay working as long as the spreadsheet of Shop Titans does not change or if the API of Google Sheets does not change.
Data fetcher from the Shop Titans spreadsheet. Goal of this project is to provide an API via full typed models to easily work with data from the spreadsheet.
The ultimate goal is to be a building block for other applications that want to consume this data.
Below an example how to use the library. Be aware, a credential json from Google is needed in order to have access to the Google Sheets API, see Acquiring Google Credential JSON.
using System.IO;
using System.Linq;
using SheetModels.Blueprints;
using SheetServices;
var credentialFile = new FileInfo("path-to-credential-json");
var googleSheetsService = new GoogleSheetsService(credentialFile);
var spreadsheetFetcher = new SpreadsheetFetcher(googleSheetsService);
// By default all data from the blue prints will be fetched
var bluePrints = spreadsheetFetcher.FetchBluePrints().ToList();
// It is also possible to add a filter to the fetch, the main filter "Item" will always be applied during fetching
var filteredBluePrints = spreadsheetFetcher.FetchBluePrints(BlueprintsFetchFlags.Components).ToList();
// Can be exported to JSON
var bluePrintsToJson = bluePrints.Select(blueprint => blueprint.ToJson()).ToList();
// Can be imported from JSON
var bluePrintsFromJson = bluePrintsToJson.Select(Blueprint.FromJson).ToList();
This project is split into multiple packages. Each package has its own responsibility.
Package | Description | NuGet |
---|---|---|
ShopTitansSpreadsheetFetcher.SheetModels | Data models of the sheets. | |
ShopTitansSpreadsheetFetcher.SheetRanges | Ranges that are used to excract models from. | |
ShopTitansSpreadsheetFetcher.SheetServices | Services used to fetch the sheets. |
The GoogleSheetsService requires a credential JSON, acquired from Google's API Key service. Please refer to Google its excelent guide on how to work with this.