Skip to content

Commit

Permalink
openpyxl
Browse files Browse the repository at this point in the history
  • Loading branch information
yasinthanvickneswaran committed Jan 31, 2024
1 parent 9062395 commit a3ca753
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions c302/W_SpreadsheetDataReader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from c302.NeuroMLUtilities import ConnectionInfo
from c302.NeuroMLUtilities import analyse_connections

from xlrd import open_workbook
from openpyxl import load_workbook
import os

spreadsheet_location = os.path.dirname(os.path.abspath(__file__))+"/data/"
Expand All @@ -14,15 +14,15 @@ def read_data(include_nonconnected_cells=False, neuron_connect=False):
conns = []
cells = []
filename = "%s8_adult.xls"%spreadsheet_location
rb = open_workbook(filename)
rb = load_workbook(filename)
print_("Opened the Excel file: " + filename)

for row in range(1,rb.sheet_by_index(0).nrows):
pre = str(rb.sheet_by_index(0).cell(row,0).value)
post = str(rb.sheet_by_index(0).cell(row,1).value)
syntype = rb.sheet_by_index(0).cell(row,2).value
num = int(rb.sheet_by_index(0).cell(row,3).value)

synclass = 'Generic_GJ' if 'EJ' in syntype else 'Chemical_Synapse'

conns.append(ConnectionInfo(pre, post, num, syntype))
if pre not in cells:
Expand All @@ -36,7 +36,7 @@ def read_data(include_nonconnected_cells=False, neuron_connect=False):
conns = []
cells = []
filename = "%s8_adult.xls"%spreadsheet_location
rb = open_workbook(filename)
rb = load_workbook(filename)

print_("Opened Excel file..: " + filename)

Expand Down

0 comments on commit a3ca753

Please sign in to comment.