Jump to content

Copy .xls file binary


Niklas81

Recommended Posts

Hi!

I try to make a copy of a excel file by "Read from Binary File" and then save the binary array whit "Write to Binary File".

But the copy file is corrupt..

Its works whith image files, and if I make a .rar file of the excel file and the copy it works...?

This is just a labb now, but the goal is to send the .xls file over RS232 to anoter computer.

Thans for anny healp.

sorry for my bad english =/

post-18308-088067600 1287418943_thumb.jp

Link to comment

tanks for the help. Im usung excel 2003. and there is no error in the read segment. The excel progran is not open when I run this vi. and if a save the data arr from the origial .xls file in another array controll and then read the coppy .xls file as binary and compere those data arrays it is identical. And as i wrote, this vi work whit anny ather file except .xls

Link to comment

tanks for the help. Im usung excel 2003. and there is no error in the read segment. The excel progran is not open when I run this vi. and if a save the data arr from the origial .xls file in another array controll and then read the coppy .xls file as binary and compere those data arrays it is identical. And as i wrote, this vi work whit anny ather file except .xls

The data out from the read and into the write are identical, yeah, but you've overlooked a pretty important terminal on the write node:

post-13461-027085400 1287439976_thumb.pn

The "prepend array or string size" parameter needs to be set to false or LV prefixes a value to your data when it writes it back to disk. Pretty silly default value for that parameter, if you ask me.

Link to comment

The data out from the read and into the write are identical, yeah, but you've overlooked a pretty important terminal on the write node:

The "prepend array or string size" parameter needs to be set to false or LV prefixes a value to your data when it writes it back to disk. Pretty silly default value for that parameter, if you ask me.

It is a goofy default, but the OP has the correct value wired.

Link to comment

The data out from the read and into the write are identical, yeah, but you've overlooked a pretty important terminal on the write node:

post-13461-027085400 1287439976_thumb.pn

The "prepend array or string size" parameter needs to be set to false or LV prefixes a value to your data when it writes it back to disk. Pretty silly default value for that parameter, if you ask me.

Thx, but as u can see, i have wire a false constant (LV 2010 constant) into the "prepend array or string size".

Which version of Excel are you using? I found with Excel 2007 it worked fine if the I gave the copy an extension of .xlsx

:oops: U gut right. The original excel file whas a .xlsx so if a give the copy the extension of .xlsx it wors fine.:D

Thx for all help.

Link to comment

It is a goofy default, but the OP has the correct value wired.

Thx, but as u can see, i have wire a false constant (LV 2010 constant) into the "prepend array or string size".

Touché! Odd, though, the code I posted worked fine with XLS and XLSX in Excel 2007.

Link to comment

Thx, but as u can see, i have wire a false constant (LV 2010 constant) into the "prepend array or string size".

:oops: U gut right. The original excel file whas a .xlsx so if a give the copy the extension of .xlsx it wors fine.:D

Thx for all help.

Hi

If you are reading files with "unknown" formatting, there is no need to use the "Binary file" functions, just use the "Text file" functions but disable the EOL conversion.

Personally I don't use the binary versions unless I have to read/write values that are to be displayed/handled in LabVIEW, and then you need to know exactly how the data was stored (byte order?, size prepended? etc.) Using the "Text file" to copy data from end to another have never failed me.

Don't forget to escape the special characters during the RS232 transfer, or are you prepending length information to the transfer?

/J

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.