Perspective system.perspective.download truncating data

I am attempting to use the system.perspective.download() function to export table results to excel on a client browser. I had no issues getting the function to work except with one column. The column in question contains a long string of numbers that represents barcode data. While the rest of the columns download successfully, the barcode column is truncated and converted to exponential form when I download the file.

Barcode: 202401701212260000035008265082884896567316249184
Download Value: 2.02402E+47

My code is as follows:

	from datetime import datetime
	
	#Get the current dataset
	dataset = system.tag.readBlocking('[default]outputDataset')[0].value
	
	#Convert the dataset into a CSV
	dataCSV = system.dataset.toCSV(dataset)
	
	#Set the filename as the current timestamp
	currentDateTime = datetime.now()
	fileName = str(currentDateTime.strftime("%Y%m%d%H%M%S%f")) + '.csv'
	
	#Download the file to the current session
	system.perspective.download(fileName, dataCSV, 'text/csv')

I already verified that there is no issue when converting to the csv format from my dataset tag. The codes are correctly displayed there meaning the issue has to be with the download function. I have tried messing around with different MIME types for the ‘Content Type’ field of the function but haven’t had any luck. I do realize that the code is quite large and maybe that is just not possible within the limitations of the function? Either way the documentation is lacking.

Has anyone had this issue or have any idea for a workaround?

What are you using to verify your csv file? Excel, for example, has a habit of formatting a cell however the heck it wants. I notice it on dates.

4 Likes

I just checked the text file and it was correct there. Probably should have looked at that first. Must be an excel issue then. Thanks!