LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Automatic File Extensions

Solved!
Go to solution

I have a while loop collecting data and writing it to a spreadsheet. However each time it saves the file, it does not have a file extension. Does anyone know how to automatically add a ".csv" to the end of the file path. I have tried concatenating the extension to the end of the path but it just doesn't save the file for some reaosn.

0 Kudos
Message 1 of 11
(5,496 Views)

It is hard to tell you how to fix it without seeing your code to see how it is broken.  How about adding .CSV to the end of the file name?

0 Kudos
Message 2 of 11
(5,488 Views)

Look at the functions in the File I/O Palette.  Do you see the pair Build Path and Strip Path?  These are used to create File Paths from Folder Paths (sometimes called the "Root") and a File Name, usually represented by a String.  If you want to specify the File Name as a "Name-without-extension", then before you make the final File Path of Folder + FileName + Extension, you need to add the Extension (with the ".") to the FileName-without-extension.  This is the String operation called Concatenate Strings.  Try it.

 

Bob Schor

 

 

Message 3 of 11
(5,425 Views)

Format into string also comes in very handy for making filenames, and if you have a lot of things to parse together into your filename, it still keeps it pretty readable.

 

Capture.PNG

Message 4 of 11
(5,414 Views)

I usually do something like this...

patheCapture.PNG

It creates a file name like this: HiQ_Raw_Data_Tuesday_June_26_2018.txt

(full path C:\HiQ_Data\HiQ_Raw_Data_Tuesday_June_26_2018.txt)

========================
=== Engineer Ambiguously ===
========================
Message 5 of 11
(5,398 Views)
Solution
Accepted by topic author MikeIsMyName

I usually try this

write data.PNG


CLD Using LabVIEW since 2013
Message 6 of 11
(5,372 Views)

Got it fixed, thanks guys!

0 Kudos
Message 7 of 11
(5,336 Views)

Sorry to bring this back up but I want the user to be prompted to enter their own file name and then the .csv is added to the end of the filename. I cant seem to figure out how to add ".csv" to the end of a user defined file name.

0 Kudos
Message 8 of 11
(5,289 Views)

Just like it is shown in the message you marked as the solution?

0 Kudos
Message 9 of 11
(5,286 Views)

You mean something like this?

fffCapture.PNG

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 10 of 11
(5,276 Views)