Python Forum
Thread Rating:
  • 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PYQT5 - SAVING ON EXCEL
#1
how can i make this more shortcut ? I don't know how you make it shorter like: prsheet.write(0,0,self.prname_line.text())

def PatientReg(self):

prfile = xlwt.Workbook()
prsheet = prfile.add_sheet('sheet 1')

prName = self.prname_line.text()
prsheet.write(0, 0, prName)

prAge = self.prage_line.text()
prsheet.write(0, 1, prAge)

prCn = self.prcn_line.text()
prsheet.write(0, 2, prCn)

prD = self.prdis_line.text()
prsheet.write(0, 3, prD)

prfile.save('patientregistration.xls')

QtWidgets.QMessageBox.information(self, "REGISTER PATIENT SUCCESSFUL", "REGISTER PATIENT SUCCESSFUL!")
self.close()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  "ModuleNotFoundError: No module named 'PyQt5.QtWidgets'; 'PyQt5' is not a package" chipx 3 7,486 Dec-09-2021, 07:05 AM
Last Post: chipx
  Problem in saving .xlsm (excel) file using pandas dataframe in python shantanu97 2 4,319 Aug-29-2021, 12:39 PM
Last Post: snippsat
  Need help with saving output into an excel file Beyondfacts 4 2,969 Mar-22-2021, 11:51 AM
Last Post: jefsummers
  Saving Excel workbook file with dataframe names Biplab1985 0 2,044 Jun-07-2020, 12:25 PM
Last Post: Biplab1985
  help with changing values in an excel sheet and saving to a new file Moneyman212 2 2,919 Nov-19-2019, 06:25 AM
Last Post: Moneyman212
  Saving as docx file from excel with new filename Chuck_Norwich 4 3,012 Oct-03-2019, 08:01 PM
Last Post: Chuck_Norwich
  Openpyxl - while saving excel file getting error shubhamjainj 1 4,604 Apr-09-2019, 12:05 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020