And this video, you learn how to update an existing column with new values and also how to add a new
column in a Google spreadsheet.
So let's start by updating this entire column.
These are temperature dots in Celsius, degree air temperature.
We want to convert this scene to Fahrenheit, which is the American temperature measurement unit, so
we're looking at the column E, which spans from two to 25 E to E 25.
So I have established a connection to the Google Sheets accounts, created a spreadsheet object, created
a worksheet object.
Now I can point to worksheet one, not update.
We said it was E to two e twenty five.
We want to update this with a new column.
Now the column comes as a list.
So before we supply a column here, we need to have that column ready.
So let's calculate a list of new temperature values in foreign lines.
First, though, we need to get to the actual the current values from E to to E twenty five.
So that is the existing column we store that's in a variable.
And let's see what we have.
As existing column.
So that is the ultimate.
Over the existing column with existing temperature values, you'll notice that each value is inside
a list.
So it's a list of only two lists tiny lists.
So the seat of A4, we need to take that into account.
When we create when we calculate the new column list, which is equal to a list comprehension, so whenever
you want to create a list out of another list, you use list comprehension.
You can also use a for loop.
But the list combinations are more by phonic and you just do the entire calculation in one line.
So what do we want to do is we want to iterate for AI in existing column.
Now what is I, I will be?
Each of these lists these.
That's and that's now what do you want to do to each list?
Hmm.
Well, first, we want to extract the item out of that list.
So I zero, right?
So if you print new column at this point.
You're going to get a flat list, so these are strings.
No, they are not lists with strings inside.
So we're doing better now, but we need to do something else to those strings.
First, we need to convert them into floats.
Run.
Yet now we have numbers, no quotes around those numbers, then for each number.
What we want to do is we want to apply know the formula that converts Celsius degree to foreign nights
and that is the formula.
So Celsius degree of value times nine divided by five plus three gives Fahrenheit.
So we're going to have a list of foreign nights for an existing column.
Executed that.
And these are the values.
And if you want to round those numbers because we have too many decimal points out, puts Iran's.
Function around the formula and put the formula and then put the formula inside parentheses.
So that is the first argument of the round function.
Then the second argument is one.
So one digit is all we need to offer the decimal point.
Now we're ready to execute the update function.
So that column will get as values this new column so you can see new column there or what I would suggest
is to put the new column in a new column like four g, for example.
So I'd like to change this to G to G 25.
But it's up to you.
So if you leave them as they are, you override the existing values.
So be aware of that.
So run now and initially you gets an error.
That is because the update method expects a list of lists, but our list is flat for now.
You see, so if you want to have that list of lists, you want to put these values into lists, so the
accounts function outputs, you have to put it into a list of when you execute again.
And so this is the new column now list of lists.
And this is that new column in the spreadsheet.
If you want to have a heads or you could do something like.
Foreign nights for the head there, so a least plus that lists because you see what we're doing is for
a night.
Plus, something like one to three, et cetera.
At least you get a concatenated list.
So that's first goes as the first item on the list of the other values go after that, the first item.
But in our case, we have this nested list.
So you want to use double square brackets executes.
And don't forget that we need to change, you know, so foreign aid goes to one.
Yeah, here we go.
So we have a new column in the spreadsheet.
And that is the entire codes for this video.
Thank you so much.
I'll talk to you a later.