We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
And here is the parser: parsers.py
import xlrd class HierarchicalXLSParser(HierarchicalCSVParser): """ Parses CSV serialized data. The parser assumes the first line contains the column names. """ media_type = 'application/vnd.ms-excel' def parse(self, stream, media_type=None, parser_context=None): book = xlrd.open_workbook(file_contents=stream) sheet = book.sheet_by_index(0) data = [] header = [] try: for row_index in range(sheet.nrows): row = [] for col_index in range(sheet.ncols): if row_index==0: header.append(sheet.cell(row_index,col_index).value) else: row.append(sheet.cell(row_index,col_index).value) if row_index!=0: row_data = dict(zip(header, row)) hierarchical_data = self._csv_convert(row_data) data.append(hierarchical_data) return data except Exception as exc: raise ParseError('HierarchicalXLS parse error - %s' % str(exc))
The text was updated successfully, but these errors were encountered:
No branches or pull requests
And here is the parser:
parsers.py
The text was updated successfully, but these errors were encountered: