get googlesheets cells with name sheet with accents - google-sheets-formula

I try to use the gradle exemple to get googlessheets cells and get error with the tab name with diacritics ("Opérations 2023") because the name is in french.
https://developers.google.com/sheets/api/quickstart/java
the error is below.
{
"code": 400,
"errors": [
{
"domain": "global",
"message": "Unable to parse range: Op%C3%A9rations%202023!A2%3AE2",
"reason": "badRequest"
}
],
"message": "Unable to parse range: Op%C3%A9rations%202023!A2%3AE2",
"status": "INVALID_ARGUMENT"
}
The request is
public static void main(String... args) throws IOException, GeneralSecurityException {
// Build a new authorized API client service.
final NetHttpTransport HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();
final String spreadsheetId = "ID";
final String range = "Opérations 2023!A2:E2";
Sheets service =
new Sheets.Builder(HTTP_TRANSPORT, JSON_FACTORY, getCredentials(HTTP_TRANSPORT))
.setApplicationName(APPLICATION_NAME)
.build();
ValueRange response = service.spreadsheets().values()
.get(spreadsheetId, range)
.execute();
List<List<Object>> values = response.getValues();
if (values == null || values.isEmpty()) {
System.out.println("No data found.");
} else {
System.out.println("Name, Major");
for (List row : values) {
// Print columns A and E, which correspond to indices 0 and 4.
System.out.printf("%s, %s\n", row.get(0), row.get(4));
}
}
}
}
What can I do please ?

I'm writing this answer as a community wiki, since the issue was resolved from the comments section, in order to provide a proper response to the question.
I tested with Sheets API Method: spreadsheets.values.get and I had no issues using it with sheet named "Opérations 2023" so it seems is not issue with the API but character encoding in Java.
I'm not an expert in Java, but while doing research, I found a similar thread and it shows the same error when using Java while doing it with Python it seems to work with no issue.
As a workaround, if the sheet you're aiming to is the first one in your Worksheet, then you can just omit the name of the Sheet and set the range to: "A2:E2", this will aim the default sheet which is the first one in your Worksheet.

Related

grpc error: packets.SubmitCustomerRequest.details: object expected

I just created a proto file like this
service Customer {
rpc SubmitCustomer(SubmitCustomerRequest) returns (SubmitCustomerResponse) {}
}
message SubmitCustomerRequest {
string name = 1;
map<string, google.protobuf.Any> details = 2;
}
message SubmitCustomerResponse {
int64 id = 1;
}
The code itself works when I called this from the client. But, I'm having trouble with testing it directly from bloomrpc or postman.
{
"name": "great name",
"details": {
"some_details": "detail value",
"some_int": 123
}
}
it throws me this error when I tried to hit it
.packets.SubmitCustomerRequest.details: object expected
I think I'm aware that the problem is with the details syntax format when I hit it on postman, but I'm not sure what the correct format is supposed to be. I've tried modifying it with any other possible format and none works either.

Getting Daily Limit for unauthenticated use Exceeded

Getting Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup
when executing the following code given in the Xamarin demo
async void OnAuthenticationCompleted (object sender, AuthenticatorCompletedEventArgs e)
{
if (e.IsAuthenticated) {
// If the user is authenticated, request their basic user data from Google
// UserInfoUrl = https://www.googleapis.com/oauth2/v2/userinfo
var request = new OAuth2Request ("GET", new Uri (Constants.UserInfoUrl), null, e.Account);
var response = await request.GetResponseAsync ();
if (response != null) {
// Deserialize the data and store it in the account store
// The users email address will be used to identify data in SimpleDB
string userJson = response.GetResponseText ();
App.User = JsonConvert.DeserializeObject<User> (userJson);
e.Account.Username = App.User.Email;
AccountStore.Create ().Save (e.Account, App.AppName);
}
}
// If the user is logged in navigate to the TodoList page.
// Otherwise allow another login attempt.
App.SuccessfulLoginAction.Invoke ();
}
This is the error I am getting
"error":{
"errors": [
{
"domain": "usageLimits",
"reason": "dailyLimitExceededUnreg",
"message" :"Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
"extendedHelp" : "https://code.google/apis/console"
}
],
"code":403,
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
}
I corrected the redireturl to "http://example.com/oauth2callback" and in the ios project modified the ATS setting by adding the following key in info.plist
NSAppTransportSecurity -- Dictionary
NSAllowsArbitraryLoadsInWebContent -- Boolean -- Yes

Listing all Vertices of specific class in OrientDB

I've recently started exploring Graph databases (in particular Neo4j and OrientDB) and have come across a problem I can't seem to put my finger on.
I'm running a local installation of OrientDB (OrientDB Server v2.0-M3 is active.).
I'm using Tinkerpops to connect to, and run queries against, the graph.
I'm using Java and Spring on a local Tomcat 7 server.
Testing my API I'm using Postman on Chrome.
Here's my faulty GET method:
#RequestMapping(value = "/articles", method = RequestMethod.GET)
public
#ResponseBody
Vector<Article> list() {
OrientGraph graph = new OrientGraph("remote:/local/path/to/orientdb/databases/mydb", "user", "password");
FramedGraphFactory factory = new FramedGraphFactory();
FramedGraph manager = factory.create(graph);
Vector<Article> articles = new Vector<>();
try {
Iterable<Vertex> vertices = graph.getVerticesOfClass("Article", false);
Iterator<Vertex> it = vertices.iterator();
if (it.hasNext()) {
do {
Article a = (Article) manager.frame(it.next(), Article.class);
articles.add(a);
} while (it.hasNext());
}
} catch (Exception e) {
e.printStackTrace();
} finally {
graph.shutdown();
}
return articles;
}
This generates the following error:
{
"timestamp": 1418562889304,
"status": 500,
"error": "Internal Server Error",
"exception": "org.springframework.http.converter.HttpMessageNotWritableException",
"message": "Could not write JSON: Database instance is not set in current thread. Assure to set it with: ODatabaseRecordThreadLocal.INSTANCE.set(db); (through reference chain: java.util.Vector[0]->$Proxy43[\"name\"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Database instance is not set in current thread. Assure to set it with: ODatabaseRecordThreadLocal.INSTANCE.set(db); (through reference chain: java.util.Vector[0]->$Proxy43[\"name\"])",
"path": "/articles"
}
I've been trying to figure this out, trying the "fix" that the error suggests. I've also tried to use TransactionalGraph instead of OrientGraph.
Here's the catch... I'm also using a similar method for getting a single resource. This method only works if I'm using the "System.out.println", otherwise it fails with the same error.
#RequestMapping(value = "/article", method = RequestMethod.GET)
public
#ResponseBody
Article get(
#RequestParam(value = "number", required = true) long number
) {
TransactionalGraph graph = new OrientGraph("remote:/path/to/local/orientdb/orientdb/databases/mydb", "user", "password");
FramedGraphFactory factory = new FramedGraphFactory();
FramedGraph manager = factory.create(graph);
Article article = null;
try {
Iterable<Article> articles = manager.getVertices("number", number, Article.class);
article = articles.iterator().next();
System.out.println(article.getName());
} catch (Exception e) {
e.printStackTrace();
} finally {
graph.shutdown();
}
return article;
}
Any help appreciated!
You should leave the graph (=connection) open while you're using the result. Can you move the graph.shutdown() after browsing your result set?

Invalid Resource Id when batch inserting

I am doing a batch insert into the Google Calendar using the .NET API. I have the following code.
var request = new BatchRequest(calendarService);
request.Queue<Event>(
calendarService.Events.Insert(
new Event
{
Id = String.Format("yot-{0}", item.AppointmentId),
Summary = item.Title,
Description = item.Description,
Start = new EventDateTime() { DateTime = item.Date },
End = new EventDateTime() { DateTime = item.Date.AddHours(item.Length) }
}, calendar.Id),
(content, error, i, message) =>
{
//Log error
});
request.ExecuteAsync();
When I execute and try and insert I get the error "Invalid resource id". What does this error mean?
You have to follow the guidelines defined here : https://developers.google.com/google-apps/calendar/v3/reference/events/insert
Basically, the id has to be between 5 and 1024 characters long and consist solely from characters in this alphabet : 0123456789abcdefghijklmnopqrstuv.
Try with a simple Guid.NewGuid() or use a Base32 Encoder if you don't want random IDs

SolrNet Error - Unable to read data from the transport connection: The connection was closed

I'm trying to search a Solr server from a webservice using SolrNet. I set up the connection in the global.asax: Startup.Init<ApartmentDoc>("http://192.168.0.100:8080/solr/");
I'm trying to query the server in a class file via:
var solr = ServiceLocator.Current.GetInstance<ISolrOperations<ApartmentDoc>>();
var apartments = solr.Query(SolrQuery.All, new QueryOptions
{
ExtraParams = new Dictionary<string, string> {
{ "defType", "edismax" } ,
{ "fl", "*,score,_dist_:geodist() " } ,
{ "bf", "recip(geodist(),1,1000,1000)" } ,
{ "fq", string.Format("{{!geofilt d={0}}}", radius * 1.609344) } ,
{ "sfield", "Location" } ,
{ "pt", string.Format("{0},{1}", centerLat, centerLong) }
}
});
return apartments;
The error I'm getting is: Unable to read data from the transport connection: The connection was closed.
I've checked the logs in TomCat, and the request is going through and the results appear to have been returned.
Any ideas why I'm not getting the results back?
Thanks,
Drew
As the 'rows' parameter wasn't defined in your code, the request is likely timing out from trying to retrieve a large number of documents. As explained in the SolrNet documentation, always define pagination parameters.

Resources