formula evaluation in cells when import excel sheet in R using read_excel









up vote
0
down vote

favorite












I want to import some excel files to R using read_excel(measured values by an instrument, with some parameters calculated using other measured values, so it has lots of formulas in some of the cells), I want to import all the files once, but when I import the files, I find the cells with formula are 0, they are not evaluated.



the basic code are:



library(readxl)
readxl_6800 <- function(path, name_rows = 42, data_rows = 43)
data_name <- read_excel(path, range= cell_rows(name_rows))
df <- read_excel(path, skip = data_rows, col_names = FALSE)
colnames(df) <- colnames((data_name))
return (df)

df


the results are:



# A tibble: 360 x 10
obs time elapsed date TIME E A Ca Ci Pci
<dbl> <dbl> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 1 1500971222. 0 20170725 16:27~ 1.50e9 0 0 0 0 0
3 3 1500971224. 2 20170725 16:27~ 1.50e9 0 0 0 0 0
4 4 1500971224. 3 20170725 16:27~ 1.50e9 0 0 0 0 0
5 5 1500971226. 4 20170725 16:27~ 1.50e9 0 0 0 0 0


where the zero values should be values larger than zero.



the sample excel can be download from:



example file



how can I import the excel in this form with the formula evaluated? any suggestions?



I do not want to rewrite these formulas in R, as it will add lots of codes in R, it is the last choice.










share|improve this question























  • It's highly unlikely folks are going to create an account on a service to download a file. Also, Microsoft Excel generally stores the computed value of the cells along with the formula. Find the equivalent of "Calculate Sheet" in your version of Excel and use it and then re-save the files. read_excel() picks up the calculated values. The xlsx package seems to have an option to refresh formulas on ingestion but I've not used it for that so cannot confirm.
    – hrbrmstr
    Nov 11 at 14:06










  • I am sorry for the links need to register, I have changed it to dropbox, and the reason I do not want to use excel to resave is that I want to write a batch program, and then people can import lots of files by the program once to save time, as the data files can be hundreds.
    – jd zhu
    Nov 11 at 14:37











  • I just wonder why the formulas can not be evalute in such a excel files with this form, as I know the formluas in a file with rectangular data form can be evlauted without any problem
    – jd zhu
    Nov 11 at 14:38














up vote
0
down vote

favorite












I want to import some excel files to R using read_excel(measured values by an instrument, with some parameters calculated using other measured values, so it has lots of formulas in some of the cells), I want to import all the files once, but when I import the files, I find the cells with formula are 0, they are not evaluated.



the basic code are:



library(readxl)
readxl_6800 <- function(path, name_rows = 42, data_rows = 43)
data_name <- read_excel(path, range= cell_rows(name_rows))
df <- read_excel(path, skip = data_rows, col_names = FALSE)
colnames(df) <- colnames((data_name))
return (df)

df


the results are:



# A tibble: 360 x 10
obs time elapsed date TIME E A Ca Ci Pci
<dbl> <dbl> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 1 1500971222. 0 20170725 16:27~ 1.50e9 0 0 0 0 0
3 3 1500971224. 2 20170725 16:27~ 1.50e9 0 0 0 0 0
4 4 1500971224. 3 20170725 16:27~ 1.50e9 0 0 0 0 0
5 5 1500971226. 4 20170725 16:27~ 1.50e9 0 0 0 0 0


where the zero values should be values larger than zero.



the sample excel can be download from:



example file



how can I import the excel in this form with the formula evaluated? any suggestions?



I do not want to rewrite these formulas in R, as it will add lots of codes in R, it is the last choice.










share|improve this question























  • It's highly unlikely folks are going to create an account on a service to download a file. Also, Microsoft Excel generally stores the computed value of the cells along with the formula. Find the equivalent of "Calculate Sheet" in your version of Excel and use it and then re-save the files. read_excel() picks up the calculated values. The xlsx package seems to have an option to refresh formulas on ingestion but I've not used it for that so cannot confirm.
    – hrbrmstr
    Nov 11 at 14:06










  • I am sorry for the links need to register, I have changed it to dropbox, and the reason I do not want to use excel to resave is that I want to write a batch program, and then people can import lots of files by the program once to save time, as the data files can be hundreds.
    – jd zhu
    Nov 11 at 14:37











  • I just wonder why the formulas can not be evalute in such a excel files with this form, as I know the formluas in a file with rectangular data form can be evlauted without any problem
    – jd zhu
    Nov 11 at 14:38












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I want to import some excel files to R using read_excel(measured values by an instrument, with some parameters calculated using other measured values, so it has lots of formulas in some of the cells), I want to import all the files once, but when I import the files, I find the cells with formula are 0, they are not evaluated.



the basic code are:



library(readxl)
readxl_6800 <- function(path, name_rows = 42, data_rows = 43)
data_name <- read_excel(path, range= cell_rows(name_rows))
df <- read_excel(path, skip = data_rows, col_names = FALSE)
colnames(df) <- colnames((data_name))
return (df)

df


the results are:



# A tibble: 360 x 10
obs time elapsed date TIME E A Ca Ci Pci
<dbl> <dbl> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 1 1500971222. 0 20170725 16:27~ 1.50e9 0 0 0 0 0
3 3 1500971224. 2 20170725 16:27~ 1.50e9 0 0 0 0 0
4 4 1500971224. 3 20170725 16:27~ 1.50e9 0 0 0 0 0
5 5 1500971226. 4 20170725 16:27~ 1.50e9 0 0 0 0 0


where the zero values should be values larger than zero.



the sample excel can be download from:



example file



how can I import the excel in this form with the formula evaluated? any suggestions?



I do not want to rewrite these formulas in R, as it will add lots of codes in R, it is the last choice.










share|improve this question















I want to import some excel files to R using read_excel(measured values by an instrument, with some parameters calculated using other measured values, so it has lots of formulas in some of the cells), I want to import all the files once, but when I import the files, I find the cells with formula are 0, they are not evaluated.



the basic code are:



library(readxl)
readxl_6800 <- function(path, name_rows = 42, data_rows = 43)
data_name <- read_excel(path, range= cell_rows(name_rows))
df <- read_excel(path, skip = data_rows, col_names = FALSE)
colnames(df) <- colnames((data_name))
return (df)

df


the results are:



# A tibble: 360 x 10
obs time elapsed date TIME E A Ca Ci Pci
<dbl> <dbl> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 1 1500971222. 0 20170725 16:27~ 1.50e9 0 0 0 0 0
3 3 1500971224. 2 20170725 16:27~ 1.50e9 0 0 0 0 0
4 4 1500971224. 3 20170725 16:27~ 1.50e9 0 0 0 0 0
5 5 1500971226. 4 20170725 16:27~ 1.50e9 0 0 0 0 0


where the zero values should be values larger than zero.



the sample excel can be download from:



example file



how can I import the excel in this form with the formula evaluated? any suggestions?



I do not want to rewrite these formulas in R, as it will add lots of codes in R, it is the last choice.







r






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 14:34

























asked Nov 11 at 13:48









jd zhu

11




11











  • It's highly unlikely folks are going to create an account on a service to download a file. Also, Microsoft Excel generally stores the computed value of the cells along with the formula. Find the equivalent of "Calculate Sheet" in your version of Excel and use it and then re-save the files. read_excel() picks up the calculated values. The xlsx package seems to have an option to refresh formulas on ingestion but I've not used it for that so cannot confirm.
    – hrbrmstr
    Nov 11 at 14:06










  • I am sorry for the links need to register, I have changed it to dropbox, and the reason I do not want to use excel to resave is that I want to write a batch program, and then people can import lots of files by the program once to save time, as the data files can be hundreds.
    – jd zhu
    Nov 11 at 14:37











  • I just wonder why the formulas can not be evalute in such a excel files with this form, as I know the formluas in a file with rectangular data form can be evlauted without any problem
    – jd zhu
    Nov 11 at 14:38
















  • It's highly unlikely folks are going to create an account on a service to download a file. Also, Microsoft Excel generally stores the computed value of the cells along with the formula. Find the equivalent of "Calculate Sheet" in your version of Excel and use it and then re-save the files. read_excel() picks up the calculated values. The xlsx package seems to have an option to refresh formulas on ingestion but I've not used it for that so cannot confirm.
    – hrbrmstr
    Nov 11 at 14:06










  • I am sorry for the links need to register, I have changed it to dropbox, and the reason I do not want to use excel to resave is that I want to write a batch program, and then people can import lots of files by the program once to save time, as the data files can be hundreds.
    – jd zhu
    Nov 11 at 14:37











  • I just wonder why the formulas can not be evalute in such a excel files with this form, as I know the formluas in a file with rectangular data form can be evlauted without any problem
    – jd zhu
    Nov 11 at 14:38















It's highly unlikely folks are going to create an account on a service to download a file. Also, Microsoft Excel generally stores the computed value of the cells along with the formula. Find the equivalent of "Calculate Sheet" in your version of Excel and use it and then re-save the files. read_excel() picks up the calculated values. The xlsx package seems to have an option to refresh formulas on ingestion but I've not used it for that so cannot confirm.
– hrbrmstr
Nov 11 at 14:06




It's highly unlikely folks are going to create an account on a service to download a file. Also, Microsoft Excel generally stores the computed value of the cells along with the formula. Find the equivalent of "Calculate Sheet" in your version of Excel and use it and then re-save the files. read_excel() picks up the calculated values. The xlsx package seems to have an option to refresh formulas on ingestion but I've not used it for that so cannot confirm.
– hrbrmstr
Nov 11 at 14:06












I am sorry for the links need to register, I have changed it to dropbox, and the reason I do not want to use excel to resave is that I want to write a batch program, and then people can import lots of files by the program once to save time, as the data files can be hundreds.
– jd zhu
Nov 11 at 14:37





I am sorry for the links need to register, I have changed it to dropbox, and the reason I do not want to use excel to resave is that I want to write a batch program, and then people can import lots of files by the program once to save time, as the data files can be hundreds.
– jd zhu
Nov 11 at 14:37













I just wonder why the formulas can not be evalute in such a excel files with this form, as I know the formluas in a file with rectangular data form can be evlauted without any problem
– jd zhu
Nov 11 at 14:38




I just wonder why the formulas can not be evalute in such a excel files with this form, as I know the formluas in a file with rectangular data form can be evlauted without any problem
– jd zhu
Nov 11 at 14:38

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249388%2fformula-evaluation-in-cells-when-import-excel-sheet-in-r-using-read-excel%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249388%2fformula-evaluation-in-cells-when-import-excel-sheet-in-r-using-read-excel%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3