a-marenkov / gsheets

A Dart library for working with Google Sheets API.
Other
78 stars 31 forks source link

How to get column letter by column name? #87

Open KennyTC opened 1 year ago

KennyTC commented 1 year ago

When I want to update a range in a spreadsheet using the this API (https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values#ValueRange), I would like to know the column letter (eg. A, B, C, ....BS, BT, ...). Because the range is following 'A1 notation'. Here is some examples of 'A1 notation'

Sheet1!A1:B2 refers to the first two cells in the top two rows of Sheet1.
Sheet1!A:A refers to all the cells in the first column of Sheet1.
Sheet1!1:2 refers to all the cells in the first two rows of Sheet1.
Sheet1!A5:A refers to all the cells of the first column of Sheet 1, from row 5 onward.
A1:B2 refers to the first two cells in the top two rows of the first visible sheet.
Sheet1 refers to all the cells in Sheet1.
'My Custom Sheet'!A:A refers to all the cells in the first column of a sheet named "My Custom Sheet." Single quotes are required for sheet names with spaces, special characters, or an alphanumeric combination.
'My Custom Sheet' refers to all the cells in 'My Custom Sheet'.

So, I need to get the column letter (A, B, C,.....). How can I get the column letter using Gsheets?

a-marenkov commented 1 year ago

Hi @KennyTC

Sorry, for delay with reply

I did not understand your question

There is A1Ref that might be helpful

If it does not help, can you please elaborate on your question - what information do you have and what result do you expect to get