BITKit/Packages/Runtime~/Unity/Common/Scripts/Google/GoogleSheelUtils.cs

36 lines
1.0 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Google.Apis.Sheets;
namespace BITKit.Beegle
{
public class GoogleSheelUtils : MonoBehaviour
{
[Header(Constant.Header.Settings)]
public string spreadsheetId;
public string sheetName;
[Header(Constant.Header.Settings)]
[TextArea]
public string json;
[Header(Constant.Header.InternalVariables)]
GoogleSheetsHelper helper;
Google.Apis.Sheets.v4.SpreadsheetsResource.ValuesResource values;
void Start()
{
DI.Register<GoogleSheelUtils>(this);
DI.Register<GoogleSheetsHelper>(helper = new(json));
values = helper.Service.Spreadsheets.Values;
}
public async void Request()
{
var range = $"{sheetName}!A:D";
var request = values.Get(spreadsheetId, range);
var response = await request.ExecuteAsync();
var _values = response.Values;
Debug.Log(request);
}
}
}