06-27-2018 01:39 PM
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.
Solved! Go to Solution.
06-27-2018 02:04 PM
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?
06-28-2018 07:43 AM
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
06-28-2018 10:51 AM
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.
06-28-2018 04:32 PM - edited 06-28-2018 04:35 PM
I usually do something like this...
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)
06-29-2018 12:38 AM
I usually try this
07-10-2018 10:10 AM
Got it fixed, thanks guys!
07-31-2018 02:55 PM
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.
07-31-2018 03:18 PM
Just like it is shown in the message you marked as the solution?
07-31-2018 04:31 PM
You mean something like this?