Dear All, I want to do this Add a value or character in a particular cell (e.g. A1) in excel using R. Please help
Thanks and regards, Dinesh
1 answer
I am not going to open that excel sheet, but I think it is much easier to simply enter the text into the sheet directly. That said, you can certainly import from excel into R directly using library readxl. See https://readxl.tidyverse.org/ for how to read and write data to excel formats and watch out for limitations (multiple sheets (works but need some additional commands) , macros, functions, ...) There is also an Excel import wizard in R-studio. Once the data is imported, you can change column names as you like. I am not 100% sure but I suspect that you will loose any formula and formatting contained in the original sheet.
Unless you want to further process the data in R it is too much overhead.
Log in to answer this question.
Context and effort are not clear. Please post the context of your question, expected example output and your effort.
Hi there, I want to add "Sample_ID" character in A1 cell, which is empty in excel sheet (attached). I want this one to be done in R
https://www.dropbox.com/s/4b17dp5sdi4hbts/Metadata1.xlsx?dl=0
Regards, Dinesh
Open xls file and very first cell would have name "Sample_ID".
Thanks for your reply. I do not want it in a new excel sheet. I want that "sample ID" in A1 cell of an existing excel sheet. How to do that ? If possible pls reply. thanks
I agree with @ Michael Dondrup below. Please do as Michael Dondrup suggested.
How many sheets are we talking, I don't really see your point here. A single file: open the file in Excel (or OpenOffice/ LibreOffice Calc, Numbers, ...), edit the column headers in the way you want, save, done. If using R for doing that, it would be pretty unwise to overwrite your original file because you might corrupt it.