When manually editing a Google Sheet, I notice that you can make part of a cell bold by simply highlighting a portion of the text and clicking the 'bold' button.
Is there way to achieve this same behavior using the API v4? I cannot seem to find anything in the documentation https://developers.google.com/sheets/api
I think that "TextFormatRun" with spreadsheets.batchUpdate in Sheets API can be achieved your goal.
As the sample situation, it supposes that the cell "A1" on the Spreadsheet has the value of hi i'm bold - and I'm not and you want to do the bold type hi i'm bold of hi i'm bold - and I'm not.
In this case, the following endpoint and request body can achieve this.
Endpoint:
https://sheets.googleapis.com/v4/spreadsheets/###spreadsheetId###:batchUpdate
Request body:
{"requests": [
{"updateCells": {
"range": {"sheetId": "###sheetId###", "startRowIndex": 0, "endRowIndex": 1, "startColumnIndex": 0, "endColumnIndex": 1},
"rows": [{"values": [{"textFormatRuns":[
{"format": {"bold": true}, "startIndex": 0},
{"format": {"bold": false}, "startIndex": 11}
]}]}],
"fields": "textFormatRuns.format.bold"
}}
]}
When you use this, please set the Spreadsheet ID and sheet ID.
References:
Method: spreadsheets.batchUpdate
TextFormatRun
If I misunderstood your question and this was not the direction you want, I apologize.
Related
Hey I have an issue with trying to do a reverse order lookup or a bottom up vlookup
My formula is
=ARRAYFORMULA(IFERROR(VLOOKUP(A3:A,{'movement co'!C:R;bfitt!C:R;gladstone!C:R;parkhurst!C:R;mayfield!C:R;alexandria!C:R;'crows nest'!C:R;newtown!C:R;'gregory hills'!C:R;annandale!C:R;graceville!C:R;'south penrith'!C:R;'north melbourne'!C:R;'back on track'!C:R;'elsternwick'!C:R;'brighton'!C:R},{16,2,3,4,15,10,5},0)))
This looks over multiple tabs/sheets to gather the data which works fine, but I need it to look at the last added row which I can't seem to make work with a sort function.
Any ideas?
try:
=ARRAYFORMULA(IFERROR(VLOOKUP(A3:A, SORT(
{'movement co'!C:R, ROW('movement co'!C:R);
bfitt!C:R, ROW(bfitt!C:R);
gladstone!C:R, ROW(gladstone!C:R);
parkhurst!C:R, ROW(parkhurst!C:R);
mayfield!C:R, ROW(mayfield!C:R);
alexandria!C:R, ROW(alexandria!C:R);
'crows nest'!C:R, ROW('crows nest'!C:R);
newtown!C:R, ROW(newtown!C:R);
'gregory hills'!C:R, ROW('gregory hills'!C:R);
annandale!C:R, ROW(annandale!C:R);
graceville!C:R, ROW(graceville!C:R);
'south penrith'!C:R, ROW('south penrith'!C:R);
'north melbourne'!C:R, ROW('north melbourne'!C:R);
'back on track'!C:R, ROW('back on track'!C:R);
'elsternwick'!C:R, ROW('elsternwick'!C:R);
'brighton'!C:R, ROW('brighton'!C:R)}, 17, 0),
{16, 2, 3, 4, 15, 10, 5}, 0)))
So finviz changed their website making it more difficult to extract data from their site. I am trying to get the date from the analyst ratings table but I get a series of numbers.
=SUBSTITUTE(INDEX(IMPORTHTML("http://finviz.com/quote.ashx?t="&$A3, "table", 11), 1, 1), "*", "")
For this formula where $A3=FB, I get 44218 for the date instead of Jan-22-21.
I don't have any experience with coding so I am just guessing here.
When I tested your formula with $A3=FB, I confirmed that Jan-22-21 is obtained in a cell. So unfortunately, in myenvironment, I couldn't replicate your situation.
But, from your question, I think that the number of 44218 is the serial number of Jan-22-21. If your Spreadsheet returns 44218 from your formula of =SUBSTITUTE(INDEX(IMPORTHTML("http://finviz.com/quote.ashx?t="&$A3, "table", 11), 1, 1), "*", ""), how about the following modification?
Modified formula:
=TEXT(TO_DATE(SUBSTITUTE(INDEX(IMPORTHTML("http://finviz.com/quote.ashx?t="&$A3, "table", 11), 1, 1), "*", "")),"mmm-dd-yy")
In this case, the cell "A3" has the value of FB.
In this formula, it supposes that =SUBSTITUTE(INDEX(IMPORTHTML("http://finviz.com/quote.ashx?t="&$A3, "table", 11), 1, 1), "*", "") returns the number of 44218 in the cell.
Result:
Other pattern:
As other pattern, I would like to propose to use IMPORTXML. In this case, I thought that the value of Jan-22-21 might be able to be directly retrieved using a xpath.
=IMPORTXML("http://finviz.com/quote.ashx?t="&$A3,"//tr[#class='body-table-rating-neutral'][1]//tr/td[1]")
In this case, the cell "A3" has the value of FB.
XPath is //tr[#class='body-table-rating-neutral'][1]//tr/td[1].
Result:
References:
TO_DATE
TEXT
IMPORTXML
44218 is the same like Jan-22-21
Why?
Because dates are numbers.
Solution
Format 44218 like date from menu
We are evaluating the highcharts JS library. We need:
to display in the same graph, up to 10 line series of 256 000 points each: OK
to display annotations: OK
to be able to set 2 X-crosshair to be able to display, inside a tooltip or a specific zone, the differences/delta in X and Y betwwen the both crossair. Is it possible to acheive that?
Best regards,
Xavier
It is a really custom functionality. It could be achieved by creating the initials plotLines and by implementing the possibility to drag them. I tried to explain everything by the comments in the demo.
Demo: http://jsfiddle.net/BlackLabel/efL6wyjr/
The initial plotLines:
xAxis: {
plotLines: [{
value: 2,
width: 4,
color: 'red',
}, {
value: 5,
width: 4,
color: 'red'
}]
},
If something is unclear - feel free to ask.
API: https://api.highcharts.com/class-reference/Highcharts.Axis#toValue
API: https://api.highcharts.com/class-reference/Highcharts.SVGRenderer#label
I have used V2 of the Survey Monkey API to get details on collectors and surveys. I am now interested in learning how to use the V3 API to Create/Modify surveys. I hope some useful tips from other users, would help me out, as I am relatively new to the API. I will be using Python.
Specifically, my use case is that I want to use a base survey as a template, and modify the answer options per recipient. Here is an example:
Recipient A would get:
Q1. On a scale of 1 (least) to 5 (most), how much do you like eating:
a. Burgers
b. Pizza
c. Hotdogs
Q2. On a scale of 1 (rarely) to 5 (very), in a typical week, how often do you eat:
a. Burgers
b. Pizza
c. Hotdogs
While recipient B would get
Q1. On a scale of 1 (least) to 5 (most), how much do you like eating:
a. Fried chicken
b. French fries
c. Tacos
Q2. On a scale of 1 (rarely) to 5 (very), in a typical week, how often do you eat:
a. Fried chicken
b. French fries
c. Tacos
How do I create the API that reads in the various answer options.
I also plan to use pandas to load the table of answer options per recipient, and want to find out how to pipe the answer options into the API - would it be through a conversion into JSON? Have read the documentation, but it's not always obvious what needs to be done (to a newbie).
Thanks so much!
As far as I'm aware, there isn't branching logic available to show/hide answer options. If you were sending the survey to one recipient at a time, and you really wanted to have one question with modified answer options you could theoretically do something like this:
POST /v3/surveys/<id>/pages/<id>/questions
{
"family": "matrix",
"subtype": "rating",
"answers": {
"rows": [
{
"text": "Burgers",
"visible": true,
"position": 1
},
{
"text": "Pizza",
"visible": true,
"position": 2
},
{
"text": "Hotdogs",
"visible": true,
"position": 3
},
{
"text": "Fried chicken",
"visible": false,
"position": 4
},
{
"text": "French fries",
"visible": false,
"position": 5
},
{
"text": "Tacos",
"visible": false,
"position": 6
}
],
"choices": [
{
"text": "1",
"position": 1
},
{
"text": "2",
"position": 2
},
{
"text": "3",
"position": 3
},
{
"text": "4",
"position": 4
},
{
"text": "5",
"position": 5
}
]
},
"headings": [
{
"heading": "On a scale of 1 (least) to 5 (most), how much do you like eating:"
}
],
"forced_ranking": false
}
And then patch visible on the answer options between true and false for each recipient, that way you can analyse on the same question. But that's not really ideal as this changes the survey for everyone taking it limiting you to one recipient taking the survey at a time.
Given you are planning on moving the data to pandas anyways, why not just separate into four different questions? Then just use advanced branching to hide/show questions based on a custom value on the recipient. That way you can have a rule that's something like:
if contact.custom1 is exactly "fried" then hide question 1 and show question 2
Then you can export all your data or fetch your responses through the API
GET /v3/surveys/<id>/responses/bulk
Which will give you a JSON of all the responses which you can move to pandas. There may be other ways to do what you'd like but given the available functionality; this is a couple examples that may be helpful.
Basically, I'm trying to have Highcharts automatically draw a straight line going from the first data point to the last, so that I can see the "overall trend" more easily.
I believe this is called a "trend line" or something, but I have not found anything in the documentation related to that. It is very possible that it still has this feature, however. Does it?
As far as I am aware, highcharts does not calculate a regression or trend lines. There are some plugins that you may be able to use. Here is one that i've found, i'm sure there are others: https://github.com/virtualstaticvoid/highcharts_trendline
Highcharts does not support this out of the box, but there are some plugins in their gallery that do trend lines.
This one for example (which we have used with success), gives multiple options including linear trend and moving averages:
http://www.highcharts.com/plugin-registry/single/16/technical-indicators
UPDATE May 2018:
Highcharts now includes this functionality as part of its core offering.
https://www.highcharts.com/docs/chart-and-series-types/technical-indicator-series
HighCharts have trend line feature.
check https://www.highcharts.com/products/plugin-registry/single/22/Highcharts%20regression
check this JSFiddle also http://jsfiddle.net/3g4ryLc9/539/
series: [{
regression: true,
regressionSettings: {
name : 'Type any name of the series..',
type: 'polynomial',
color: 'rgba(223, 183, 83, .9)',
dashStyle: 'solid'
},
name: 'Test input',
color: 'rgba(223, 83, 83, .5)',
data: [
[1, 1],
[2, 3],
[3, 9],
]