If csvfile is a file object, it should be opened with newline=''.
with open(r'C:UsersHanjuDesktopuploadPortal(5).csv',"w", newline='') as _csvfile: writer = csv.writer(_csvfile)