Every line of 'python read xlsx' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
94 def test_multiple_sheet(self): 95 b = self.reader_class() 96 b.open(self.merged_book_file) 97 sheets = b.read_all() 98 for key in sheets: 99 sheets[key] = list(sheets[key]) 100 self.assertEqual(sheets, self.expected_sheets)
34 def read_excel_file(f): 35 dialect = csv.Sniffer().sniff(codecs.EncodedFile(f, "utf-8").read(1024)) 36 #f.open() 37 return UnicodeCsvReader(codecs.EncodedFile(f, "utf-8"), 38 "utf-8", dialect=dialect)
89 def test_non_default_sheet_as_single_sheet_plain_reader(self): 90 r = pe.load(self.testfile, "Sheet2") 91 data = list(r.rows()) 92 assert data == self.content["Sheet2"]
8 def read(self): 9 workbook = self.open_workbook() 10 worksheet = self.get_worksheet(workbook) 11 12 data = self.extract_data(worksheet) 13 data = data[self.options.get('skip', 0):] 14 15 headers = self.options.get('headers', True) 16 if headers is True: 17 headers, data = data[0], data[1:] 18 if headers: 19 return [dict(zip(headers, row)) for row in data] 20 else: 21 return data
13 def test_xlsx(self): 14 with open('examples/test.xlsx', 'rb') as f: 15 output = xlsx.xlsx2csv(f) 16 17 with open('examples/testxlsx_converted.csv', 'r') as f: 18 self.assertEquals(f.read(), output)