Greetings
I am trying to execute the sample API code on GITHUB, in python for me to read and write sheets.
I don't understand the use of the following line of codes.
Do I need to replace _file_ ? and what do I replace it with ?
_dir = os.path.dirname(os.path.abspath(__file__))
# The API identifies columns by Id, but it's more convenient to refer to column names. Store a map here
column_map = {}
When I try to run the code(in bold) I keep getting errors:
SyntaxError: unexpected EOF while parsing
# Helper function to find cell in a row
def get_cell_by_column_name(row, column_name):
column_id = column_map[column_name]
return row.get_column(column_id)
column_id = column_map[column_name]
Traceback (most recent call last):
File "<ipython-input-43-bdf21b82574e>", line 1, in <module>
column_id = column_map[column_name]
NameError: name 'column_name' is not defined
return row.get_column(column_id)
File "<ipython-input-44-d03dd4f29042>", line 1
return row.get_column(column_id)
^
SyntaxError: 'return' outside function
Can someone please explain what I am doing wrong?
Thank you