Question

Lets say I have a DBF file with data as shown:

Header1 Header2

1 5

2 6

3 7

4 8

And I would like to point to cell A2, add it to B2, create a new column on C titled Header3 and write the answer to C3, how do I go about doing that?

Was it helpful?

Solution

Firstly, dbf files are not spreadsheets. Thinking of them as spreadsheet cells is not helpful.

The answer to your question depends on what package/module you are using to access this file. If you are using mine it would look something like this:

import dbf

my_table = dbf.Table('/path/and/filename')

with my_table:
    my_table.add_fields('header3 N(3,0)')

    for record in dbf.Process(my_table):
        record.header3 = record.header1 + record.header2
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top