How to extract the value of an excel cell using Python?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I have an excel cell that contains a formula (eg '= A1 + B1').



I want to extract the value (es.'a = Scheda_zero.cell (line, 13) .value ')



The shell returns me the string of the formula contained ('= A1 + B1').



How can I solve this?










share|improve this question

























  • Are you using a python excel package? If so which one? openpyxl has a data_only=true attribute when loading a workbook

    – pmkro
    Nov 23 '18 at 17:00











  • Thank you. Everything works now. But where are you find this solution? I try to serch it in readthedocs (openpyxl) but I did not find it...

    – Fabio Bianchi
    Nov 23 '18 at 20:17











  • I just did a quick google search and found it on anther SO question. Also, its what I have in my code

    – pmkro
    Nov 23 '18 at 20:36













  • Well! I have another small problem. I edit an excel file with a protected sheet. Everything works perfectly. When I save the file some cells are locked e the subsequent user can not write inside.

    – Fabio Bianchi
    Nov 23 '18 at 20:42


















0















I have an excel cell that contains a formula (eg '= A1 + B1').



I want to extract the value (es.'a = Scheda_zero.cell (line, 13) .value ')



The shell returns me the string of the formula contained ('= A1 + B1').



How can I solve this?










share|improve this question

























  • Are you using a python excel package? If so which one? openpyxl has a data_only=true attribute when loading a workbook

    – pmkro
    Nov 23 '18 at 17:00











  • Thank you. Everything works now. But where are you find this solution? I try to serch it in readthedocs (openpyxl) but I did not find it...

    – Fabio Bianchi
    Nov 23 '18 at 20:17











  • I just did a quick google search and found it on anther SO question. Also, its what I have in my code

    – pmkro
    Nov 23 '18 at 20:36













  • Well! I have another small problem. I edit an excel file with a protected sheet. Everything works perfectly. When I save the file some cells are locked e the subsequent user can not write inside.

    – Fabio Bianchi
    Nov 23 '18 at 20:42














0












0








0








I have an excel cell that contains a formula (eg '= A1 + B1').



I want to extract the value (es.'a = Scheda_zero.cell (line, 13) .value ')



The shell returns me the string of the formula contained ('= A1 + B1').



How can I solve this?










share|improve this question
















I have an excel cell that contains a formula (eg '= A1 + B1').



I want to extract the value (es.'a = Scheda_zero.cell (line, 13) .value ')



The shell returns me the string of the formula contained ('= A1 + B1').



How can I solve this?







python excel






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 17:04









antoine-sac

2,78221442




2,78221442










asked Nov 23 '18 at 16:57









Fabio BianchiFabio Bianchi

34




34













  • Are you using a python excel package? If so which one? openpyxl has a data_only=true attribute when loading a workbook

    – pmkro
    Nov 23 '18 at 17:00











  • Thank you. Everything works now. But where are you find this solution? I try to serch it in readthedocs (openpyxl) but I did not find it...

    – Fabio Bianchi
    Nov 23 '18 at 20:17











  • I just did a quick google search and found it on anther SO question. Also, its what I have in my code

    – pmkro
    Nov 23 '18 at 20:36













  • Well! I have another small problem. I edit an excel file with a protected sheet. Everything works perfectly. When I save the file some cells are locked e the subsequent user can not write inside.

    – Fabio Bianchi
    Nov 23 '18 at 20:42



















  • Are you using a python excel package? If so which one? openpyxl has a data_only=true attribute when loading a workbook

    – pmkro
    Nov 23 '18 at 17:00











  • Thank you. Everything works now. But where are you find this solution? I try to serch it in readthedocs (openpyxl) but I did not find it...

    – Fabio Bianchi
    Nov 23 '18 at 20:17











  • I just did a quick google search and found it on anther SO question. Also, its what I have in my code

    – pmkro
    Nov 23 '18 at 20:36













  • Well! I have another small problem. I edit an excel file with a protected sheet. Everything works perfectly. When I save the file some cells are locked e the subsequent user can not write inside.

    – Fabio Bianchi
    Nov 23 '18 at 20:42

















Are you using a python excel package? If so which one? openpyxl has a data_only=true attribute when loading a workbook

– pmkro
Nov 23 '18 at 17:00





Are you using a python excel package? If so which one? openpyxl has a data_only=true attribute when loading a workbook

– pmkro
Nov 23 '18 at 17:00













Thank you. Everything works now. But where are you find this solution? I try to serch it in readthedocs (openpyxl) but I did not find it...

– Fabio Bianchi
Nov 23 '18 at 20:17





Thank you. Everything works now. But where are you find this solution? I try to serch it in readthedocs (openpyxl) but I did not find it...

– Fabio Bianchi
Nov 23 '18 at 20:17













I just did a quick google search and found it on anther SO question. Also, its what I have in my code

– pmkro
Nov 23 '18 at 20:36







I just did a quick google search and found it on anther SO question. Also, its what I have in my code

– pmkro
Nov 23 '18 at 20:36















Well! I have another small problem. I edit an excel file with a protected sheet. Everything works perfectly. When I save the file some cells are locked e the subsequent user can not write inside.

– Fabio Bianchi
Nov 23 '18 at 20:42





Well! I have another small problem. I edit an excel file with a protected sheet. Everything works perfectly. When I save the file some cells are locked e the subsequent user can not write inside.

– Fabio Bianchi
Nov 23 '18 at 20:42












1 Answer
1






active

oldest

votes


















0














You can use the openpyxl data_only kwarg as @pmkro indicated, but note that this will give you None if the function has never been evaluated. Open the excel file and let the functions evaluate before saving if this happens.



Then you can read the file as usual:



openpyxl.load_workbook("file.xlsx", data_only=True)


And select the cell as usual:



cell = sheet["A1"].value





share|improve this answer
























  • This is the right way. Thanks a lot!!!

    – Fabio Bianchi
    Nov 23 '18 at 20:14














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',
autoActivateHeartbeat: false,
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%2f53450500%2fhow-to-extract-the-value-of-an-excel-cell-using-python%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You can use the openpyxl data_only kwarg as @pmkro indicated, but note that this will give you None if the function has never been evaluated. Open the excel file and let the functions evaluate before saving if this happens.



Then you can read the file as usual:



openpyxl.load_workbook("file.xlsx", data_only=True)


And select the cell as usual:



cell = sheet["A1"].value





share|improve this answer
























  • This is the right way. Thanks a lot!!!

    – Fabio Bianchi
    Nov 23 '18 at 20:14


















0














You can use the openpyxl data_only kwarg as @pmkro indicated, but note that this will give you None if the function has never been evaluated. Open the excel file and let the functions evaluate before saving if this happens.



Then you can read the file as usual:



openpyxl.load_workbook("file.xlsx", data_only=True)


And select the cell as usual:



cell = sheet["A1"].value





share|improve this answer
























  • This is the right way. Thanks a lot!!!

    – Fabio Bianchi
    Nov 23 '18 at 20:14
















0












0








0







You can use the openpyxl data_only kwarg as @pmkro indicated, but note that this will give you None if the function has never been evaluated. Open the excel file and let the functions evaluate before saving if this happens.



Then you can read the file as usual:



openpyxl.load_workbook("file.xlsx", data_only=True)


And select the cell as usual:



cell = sheet["A1"].value





share|improve this answer













You can use the openpyxl data_only kwarg as @pmkro indicated, but note that this will give you None if the function has never been evaluated. Open the excel file and let the functions evaluate before saving if this happens.



Then you can read the file as usual:



openpyxl.load_workbook("file.xlsx", data_only=True)


And select the cell as usual:



cell = sheet["A1"].value






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 23 '18 at 17:31









Charles LandauCharles Landau

2,8011317




2,8011317













  • This is the right way. Thanks a lot!!!

    – Fabio Bianchi
    Nov 23 '18 at 20:14





















  • This is the right way. Thanks a lot!!!

    – Fabio Bianchi
    Nov 23 '18 at 20:14



















This is the right way. Thanks a lot!!!

– Fabio Bianchi
Nov 23 '18 at 20:14







This is the right way. Thanks a lot!!!

– Fabio Bianchi
Nov 23 '18 at 20:14






















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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53450500%2fhow-to-extract-the-value-of-an-excel-cell-using-python%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







這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini