Assigning cell from Excel to variable

I was just wondering how can I access a cell in an Excel spreadsheet that I imported and assign that specific cell to a variable? Any help would be greatly appreciated!

Not sure how you've "imported" the excel file, but the readxl package would help for this. Specifically, the range argument of readxl::read_excel() function which allows you to specify the exact location of the cell(s) you want to import.

E.g., assuming you have an excel file called "my_excel_file.xlsx" in your current working directory, and the data you want to read from it is located in the cell B2 on a sheet Sheet1 :

read_excel(path = "my_excel_file.xlsx", range = "Sheet1!B2")

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.