Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throwing exceptions if column name contains commas #58

Open
rumblerina opened this issue Aug 18, 2021 · 0 comments
Open

Throwing exceptions if column name contains commas #58

rumblerina opened this issue Aug 18, 2021 · 0 comments

Comments

@rumblerina
Copy link

rumblerina commented Aug 18, 2021

I'm trying to make a python code for converting a .dbf file into an .xlsx file, but it throws an exception (with the name of a column in question, which doesn't make me understand it any better) when the column name has a comma. It doesn't throw one if it doesn't though:

from openpyxl import Workbook, load_workbook
from dbfread import DBF

wb = Workbook()
table = DBF("DBRADON.DBF", load = True, ignore_missing_memofile=True)
length = len(table)
ws1 = wb.create_sheet("RFD", 0)
ws2 = wb.create_sheet("RAC")
ws1['A1'] = "Date"
ws1['E1'] = "Measurement Start"
ws1['F1'] = "Measurement End"
ws1['G1'] = "Exposition Length"
ws1['H1'] = "Measurement Length"
ws1['I1'] = "Radon activity"
ws1['J1'] = "Radon activity +-"
ws1['K1'] = "RFD"
ws1['L1'] = "RFD+-"
ws1['O1'] = "SK-13"
E = []
for e in range(2, len(table)):
    E.append('E' + str(e))

#print(table.records[12]['A214BI']) #This doesn't throw an exception
#print(table.records[12]['BGTM,N,2,0']) #This throws an exception

wb.save('radon.xlsx')

File in question is attached:
DBRADON.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant