[Plugins] [Support] GSheets Operator - Control Google Sheets directly from Unreal Engine

Thanks, man you do amazing job on this plugin. Thank you

Hello Jared Therriault! I am already installed GSheetsOperator package. My main task in my project is import data from Google Sheets as CSV file with using your API. At first time everything worked is correctly, but on the next day and beyond i start getting the JWT error: “Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values in the JWT claim”. Although am using GenerateTokenInfoFromJson method each time before CreateAndAuthentificate method if token expired.
Also i debug C++ code and saw that in OnResponseReceivedReturnToken method accessToken variable, which we want to give in CallOnComplete.ExecuteIfBound() is empty. I don’t know the reason why is that. Maybe am doing something wrong?

Hi Oleg, can you show me your code and how you have it implemented? Thank you.

Submitted a new version today:

12-3-2023 (5.3.0.1, 5.2.1.0, 5.1.1.1): Fix for ‘LogAutomationTest: Error: UObject.Class AttemptToFindUninitializedScriptStructMembers will be marked as failing due to errors being logged’. Caused by uninitialized struct members when packaging.

I’m really need some help with my GSO plugin because I’m getting crashes using it on editor and in a shipping version.

The first crash I get when I try to use it when my pc doesn’t have internet ( because I’m trying to check which http answer it would return me.

The second crash happens when I run this plugin on a shipping build when I try to generate a new token… when it tries to generate it crashes the application.

Here’s the logs for editor version and shipping version

LoginId:f80e9abc4d03641aaff4abab14e70ed5

EpicAccountId:c370442e58bb405aaac7f2a4bf982b7e

Assertion failed: IsValid() [File:D:\RocketSync\5.3.0-27405482+++UE5+Release-5.3\Working\Engine\Source\Runtime\Core\Public\Templates\SharedPointer.h] [Line: 1139]

UnrealEditor_GoogleSheetsOperator!UGoogleSheetsOperator::OnResponseReceivedReturnToken() [D:\build\U5M-Marketplace\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\GSheetsOperator\Source\GoogleSheetsOperator\Private\GoogleSheetsOperator.cpp:2087]

UnrealEditor_GoogleSheetsOperator!UE::Core::Private::Tuple::TTupleBase<TIntegerSequence<unsigned int,0,1,2>,FGoogleSheetsTokenInfo,FGoogleSheetsOperationParams,FGSOGetJWTDelegate>::ApplyAfter<void (__cdecl UGoogleSheetsOperator::*const &)(TSharedPtr<IHttpReq() [D:\RocketSync\5.3.0-27405482+++UE5+Release-5.3\Working\Engine\Source\Runtime\Core\Public\Templates\Tuple.h:311]

UnrealEditor_GoogleSheetsOperator!TBaseUObjectMethodDelegateInstance<0,UGoogleSheetsOperator,void __cdecl(TSharedPtr<IHttpRequest,1>,TSharedPtr<IHttpResponse,1>,bool),FDefaultDelegateUserPolicy,FGoogleSheetsTokenInfo,FGoogleSheetsOperationParams,FGSOGetJWTDe() [D:\RocketSync\5.3.0-27405482+++UE5+Release-5.3\Working\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:665]

UnrealEditor_HTTP!TDelegate<void __cdecl(TSharedPtr<IHttpRequest,1>,TSharedPtr<IHttpResponse,1>,bool),FDefaultDelegateUserPolicy>::ExecuteIfBound<void,0>() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateSignatureImpl.inl:570]

UnrealEditor_HTTP!FCurlHttpRequest::FinishRequest() [D:\build++UE5\Sync\Engine\Source\Runtime\Online\HTTP\Private\Curl\CurlHttp.cpp:1322]

UnrealEditor_HTTP!FHttpManager::Tick() [D:\build++UE5\Sync\Engine\Source\Runtime\Online\HTTP\Private\HttpManager.cpp:434]

UnrealEditor_Core!TBaseRawMethodDelegateInstance<0,FTSTickerObjectBase,bool __cdecl(float),FDefaultDelegateUserPolicy>::Execute() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:518]

UnrealEditor_Core!FTSTicker::FElement::Fire() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Private\Containers\Ticker.cpp:157]

UnrealEditor_Core!FTSTicker::Tick() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Private\Containers\Ticker.cpp:110]

UnrealEditor_Core!FTSBackgroundableTicker::FTSBackgroundableTicker'::2’::<lambda_1>::operator()() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Private\Containers\BackgroundableTicker.cpp:28]

UnrealEditor_Core!TBaseFunctorDelegateInstance<bool __cdecl(float),FDefaultDelegateUserPolicy,TFunction<bool __cdecl(float)> >::Execute() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:863]

UnrealEditor_Core!FTSTicker::FElement::Fire() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Private\Containers\Ticker.cpp:157]

UnrealEditor_Core!FTSTicker::Tick() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Private\Containers\Ticker.cpp:110]

UnrealEditor!FEngineLoop::Tick() [D:\build++UE5\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:6073]

UnrealEditor!GuardedMain() [D:\build++UE5\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:188]

UnrealEditor!GuardedMainWrapper() [D:\build++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:118]

UnrealEditor!LaunchWindowsStartup() [D:\build++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:258]

UnrealEditor!WinMain() [D:\build++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:298]

UnrealEditor!__scrt_common_main_seh() [D:\a_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]

kernel32

ntdll

We’re working on resolving this via email.

New version submitted!

3-24-2024 (5.3.2, 5.2.2, 5.1.2): Fix crash while offline, return 503 error code

Epic informed me that the GSheets Operator version for 5.4 is now live!

Hello, @JaredTherriault ,

This plugin is great! I got a prototype working in blueprints and if fits very well in my system. Now I’m rebuilding the system in C++ and it’s causing problems. I copied all my blueprint stuff into C++, but it isn’t working. The first thing I do is authenticate, but I get stuck there. I can’t tell if it’s authenticating successfully or not. I bound a function to the FGSOGetJWTDelegate, but that function isn’t getting run. Also, when I first open the editor, the first time the authentication happens, I get a wall of red text and occasionally a crash, but after that, if I run it again, I get this:

LogGoogleSheetsOperator: UGoogleSheetsOperator 90 created.
LogTemp: Warning: throw_if_error reached
LogTemp: Warning: throw_if_error reached
LogGoogleSheetsOperator: UGoogleSheetsOperator::CreateJavaWebToken: Token:
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9… (It’s an incredibly long string so I’m not gonna paste it all).

Here is my code:

SpreadsheetCollector.cpp

USpreadsheetCollector::USpreadsheetCollector()
{
	Authentication = NewObject<UAuthentication>();
	Authentication->OnAuthenticationFailed.AddDynamic(this, &USpreadsheetCollector::OnAuthenticationFailed);
}

void USpreadsheetCollector::BeginJob(const FString NewUrl)
{
	SpreadsheetUrl = NewUrl;
	Authenticate();
}

void USpreadsheetCollector::Authenticate()
{
	Authentication->Authenticate(AuthenticationInfo);
}

void USpreadsheetCollector::OnAuthenticationFailed()
{
	PrintToScreenAndLog(AuthenticationInfo.AuthenticationResponse, FColor::Red);
}

void USpreadsheetCollector::CollectSpreadsheet(FGoogleSheetsCallbackInfo CallbackInfo, UGoogleSheetsWebToken* WebToken)
{
	Authentication->OnAuthenticationCompleted.BindUFunction(this, "CollectSpreadsheet");
	
	FString SheetId = GetSheetIdFromURL(SpreadsheetUrl);
	
	FGoogleSheetsOperationParams OperationParams;
	FGoogleSheetsReadOptions ReadOptions;
	UGoogleSheetsOperator::RequestGoogleSheetsSheetValueRange(WebToken, OperationParams, OnRequestSpreadsheetComplete, GetSheetRange(), ReadOptions,SheetId, 0, true);
}

FString USpreadsheetCollector::GetSheetIdFromURL(const FString Url) const
{
	FString Id;
	UGoogleSheetsOperator::GetSpreadsheetIdFromUrl(Url, Id);
	return Id;
}

FString USpreadsheetCollector::GetSheetRange() const
{
	return UGoogleSheetsSheetTabData::GetRangeInA1_NotationFromColumnAndRowIndices(-1, -1, 3, 123);
}

Authentication.cpp

void UAuthentication::Authenticate(FAuthenticationInfo& AuthInfo)
{
	FGoogleSheetsTokenInfo TokenInfo;

	// Get the path to the plugin folder
	FString PluginDir = FPaths::ProjectPluginsDir() / TEXT("ValueEngineeringSystem");

	// Construct the relative path to GSheetsAuthToken.json
	FString FilePath = FPaths::Combine(*PluginDir, TEXT("Resources/GSheetsAuthToken.json"));
	
	
	if (!UGoogleSheetsOperator::GenerateTokenInfoFromFile(TokenInfo, FilePath))
	{
		AuthInfo.bSuccessfullyAuthenticated = false;
		AuthInfo.AuthenticationResponse = "Failed to generate token from file.";
		OnAuthenticationFailed.Broadcast();
		return;
	}
	
	FGoogleSheetsOperationParams OperationParams;
	UGoogleSheetsOperator::CreateAndAuthenticateToken(TokenInfo, OperationParams, OnAuthenticationCompleted);
}```

Hey dudebat923! Sorry for the latency on this.

Looking at the log excerpt, it doesn’t appear that the issue you’re seeing is related to the plugin. Would you be able to send me your full logs?

For users looking for a 5.5 version of GSheets Operator, it was approved over a week ago but has not appeared in the launcher yet for some reason. I have contacted Epic about this. If you need a 5.5 version right now, please contact me and I’ll send the source over, but you will need to build binaries on your own.

I will update this when Epic resolves the issue.

This situation should now be resolved! Thank you everyone for your patience! GSheets