Copy/Paste tab or comma-separated columns to Numbers in separated cells


I am trying to copy/paste the output of my terminal from VS Code into three columns (datetime, latitude, longitude) in a .numbers table. Basically, I’m running a script that gives me datetime, lat, lon in my Terminal.

While Excel has had not trouble putting the output in three separate cells, Numbers doesn’t seem to be recognizing tab nor comma-separated values as column separators. I do know I could solve this by creating a .csv file instead, and then importing it into Numbers, but that’s unpractical for my context.

Am I missing something? Is this just not something that’s feasible with Numbers?

I have tried manually copy-pasting the output from the Terminal, and automating the ‘copy’ via pbcopy, but none have worked. I end up with everything in one cell. Screenshot of a .numbers table with three columns with headers and a row with a single cell containing datetime hh:mm:ss.00 latitude longitude in a single row, not aligned with the columns.

Here’s a snippet of the code.

current_time = datetime.now(UTC)
datetime_with_ms = current_time.strftime('%Y-%m-%d %H:%M:%S.%f')[:-3] 
                    
lat = msg.latitude
lon = msg.longitude

#To manually copy-paste
print(f"{datetime_with_ms}\t{lat}\t{lon}")


#automated copy into clipboard
output_line = f"{datetime_with_ms}\t{lat}\t{lon}"
subprocess.run("pbcopy", text=True, input=output_line)

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img