Feb-06-2021, 06:54 PM
(This post was last modified: Feb-06-2021, 06:54 PM by codebeacon.)
I was able to fix the issue, I realized I accidentally type casted a variable! In terms of my other question though: should I use the
------------------
Hi,
I'm having some trouble using the pyexcel library to read .xlsx files. I already installed the package to read .xlsx files through pip3 but whenever I try running printing out the values in a for loop, or anywhere for that matter, it keeps giving me an error. I've tried using other inbuilt methods such as .keys(), .values(), etc. but they all keep giving me errors as well. My other question is: would it be good practice to put my code in
I will leave my code and my error down below. If anyone could help me that would be gladly appreciated! :)
Here is the code:
with open(...)or would that not be appropriate in this scenario?
------------------
Hi,
I'm having some trouble using the pyexcel library to read .xlsx files. I already installed the package to read .xlsx files through pip3 but whenever I try running printing out the values in a for loop, or anywhere for that matter, it keeps giving me an error. I've tried using other inbuilt methods such as .keys(), .values(), etc. but they all keep giving me errors as well. My other question is: would it be good practice to put my code in
with open('test.xlsx', mode='r'.....)would it make sense to do that in this situation and if so how would I incorporate that properly?
I will leave my code and my error down below. If anyone could help me that would be gladly appreciated! :)
Here is the code:
import pyexcel as p records = p.get_records(file_name="test.xlsx") for row in records: print(f"{row['Cells']}")The error:
Error:print(f"{row['Cells']}") TypeError: string indices must be integers