tidyverse / googlesheets4

Google Spreadsheets R API (reboot of the googlesheets package)
https://googlesheets4.tidyverse.org
Other
360 stars 53 forks source link

Feature Request: Something like Googlescripts' `.setNumberFormat()` #296

Open benyamindsmith opened 1 year ago

benyamindsmith commented 1 year ago

First off, thank Jenny an all other contributors for putting so much work in such a useful R package!

I am working with using googlesheets4 for some automations but I have noticed that there are challenges with being able to format data in a human readable format that is also compatible with sheets (i.e. without a leading apostrophe '). After playing around with recording some macros on Google Sheets/App Scripts I discovered the setNumberFormat() method.

E.g.

mySheet.getRange('BE:BE').setNumberFormat('m"/"d"/"yy')

I wonder if it would be possible to have a function like gs4_formula() that would be able to format numbers in a desired format.

E.g for dates:

(excuse the messy code)

df$dates_formatted <- gs4_set_number_format(df$dates,"m/d/yy")