code: def text(self):
          
          text = []
          rows = self.rowCount()
          cols = self.columnCount()
  
          # handle empty table case
          if rows == 2 and cols == 2:
              item = self.item(0, 0)
              if item is None:
                  return ''
  
          for r in range(rows - 1):
              for c in range(cols - 1):
                  item = self.item(r, c)
                  if item is not None:
                      value = item.text()
                  else:
                      value = '0'
  
                  if not value.strip():
                      value = '0'
  
                  text.append(' ')
                  text.append(value)
              text.append(ROW_SEPARATOR)
  
          return ''.join(text[:-1])
docs: Return the entered array in a parseable form.