cancelar
Mostrando los resultados de 
Buscar en lugar de 
Quiere decir: 

Save data to spreadsheet

¡Resuelto!
Ir a solución

Hello All,

 

I need to write 2D array of data to spreadsheet.

Every time I press some button, new file should be created with date and time in file name.

 

Can someone advise how to create this?

 

Thank you.

Milan

 

0 kudos
Mensaje 1 de 11
4.521 Vistas

Hi Milan,

 

which of these steps is a problem to you?

What have you tried so far? Where are you stuck?

 

Use FormatIntoString to create a file name according to your needs. (FormatDateTimeString might work too.)

Then use BuildPath to create a valid path for your desired file.

Then use WriteDelimitedSpreadsheet to save your 2D array…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 kudos
Mensaje 2 de 11
4.508 Vistas

Hello,

 

please check attachment.

 

First I have problem creating subfolder, where all files will be saved.

 

Best regards.

0 kudos
Mensaje 3 de 11
4.502 Vistas

Hi Milan,

 


please check attachment.

First I have problem creating subfolder, where all files will be saved.

I cannot check the VI as I only have LV2017 available right now. (You might attach a snippet or a downconverted version of your VI.)

To create a subfolder you can use this CreateFolder function…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 kudos
Mensaje 4 de 11
4.498 Vistas

Hi Gerd,

 

I tried with create folder first...

1.PNG

and with build path

2.PNG

 

0 kudos
Mensaje 5 de 11
4.487 Vistas

Hi milan,

 

error 10: you should not try to create an already exisiting folder…

error 43: you cancelled an operation, so it is not the fault of BuildPath…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 kudos
Mensaje 6 de 11
4.476 Vistas

Hi,

 

i manage to create folder, but write spreadsheet always ask to chose file to write... 

I need to create file, not to open existing one...

3.PNG

0 kudos
Mensaje 7 de 11
4.469 Vistas

Hi Milan,

 

what is the full path that you feed into WriteDelimitedFile?

Does it contain a valid path, with all folders already existing and a valid filename?

 

Edit:

Found the problem - by debugging…

Look inside WriteDelimitedFile: inside WriteSpreadsheetString a new file is opened without providing a filepath. This will trigger the FileOpen dialog…

(You should have found out that too - by debugging…)

 

Solution:

Create the file on your own using FileOpen. Then convert the string using ArrayToSpreadsheetString. Then write that string using WriteToTextFile. Don't forget to close the file afterwards…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 kudos
Mensaje 8 de 11
4.456 Vistas

Hi Gerd,

 

I tried that way, but problem is obviously when I append file name (date, time) to the path, then probe shows that this is not a path. Of course, because this file doesn't exist yet. Why cannot create file with specific file name?

5.PNG  Thanks

0 kudos
Mensaje 9 de 11
4.443 Vistas
Solución
Aceptado por el autor del tema milan87

Hi Milan,

 

there are several forbidden characters in filenames. The colon (:) is one of them!

 

(This is basic knowledge for using computers and not related to LabVIEW.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 kudos
Mensaje 10 de 11
4.436 Vistas