2

I am trying to import a Google Spreadsheet with formulas (specifically with =HYPERLINK formulas) in addition to or instead of the values for a column.

There are many helpful posts on how to import Google Spreadsheers into R, but, at least using a CSV file, these import the values but not the formulas of cells.

The "View" -> "All formulas" option in Google Spreadsheets shows all of the formulas but even with this approach the values of the cells but not the formulas are returned.

Any there any relatively straightforward ways to import a Google Spreadsheets with Formulas into R? And if not, are there any other approaches that may work?

Community
  • 1
  • 1
Joshua Rosenberg
  • 4,014
  • 9
  • 34
  • 73

3 Answers3

3

I strongly suspect you only get values I would file an issue ticket (after checking the documentation first, of course) at the googlesheets project which just last week had its first CRAN release.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
2

All the GoogleSheets -> R packages export a csv from GoogleSheets, so it will only show the values.

The best way sounds like to copy-paste the forumlas of your Google Sheet into text page:

first do a find-replace of (equals)

= 

to (single quote-equals)

'= 

This will get rid of the formulas and change them back into strings, then copy-paste back into Google sheets or R.

Hacky :)

MarkeD
  • 2,500
  • 2
  • 21
  • 35
1

gs_read_cellfeed() function from googlesheets library reads googlesheet data in dataframe where each cell as 1 row. value is cell value, input_value - formula

Yuriy Barvinchenko
  • 1,465
  • 1
  • 12
  • 17