I am using automation to download a .dat file and parse it using excel parser module in perl.
But whenever i tried to access the .dat file it says not a valid excel file. (all these operation has been done in linux)
As a work around I have moved the .dat file to windows machine and opened it using excel file.
Then saved the .dat file as an excel file in windows. Then resend that file to Linux machine. Now the perl script can parse the file.
Instead of this long path can I convert the .dat file to excel file in linux itself?
If yes then how?
First Few Lines from my .dat file :
F_NF_CD ART_GRP_NO ART_GRP_DESCR ART_GRP_SUB_NO ART_GRP_SUB_DESCR ART_NO ART_DESC SELL_UNIT PACK_TYPE SELL_PR VAT_PERC MRP_PRICE STOCK ART_STATUS EXTRA_INFO BLOCK_IND
F 191 HYGIENE PAPERS 3 LADIE'S HYGIENE 287432 SOFY SIDE WALLS LARGE SOFT15P 1 EA 89.8 5 99 47 1 SELL
F 191 HYGIENE PAPERS 3 LADIE'S HYGIENE 287422 SOFY SIDE WALLS REGULAR SOFT15P 1 EA 80.73 5 89 0 1 SELL
Actually the script tries to read the meta data of a file before parsing it. If the module see the metadata is not excel it won't proceed further. So it is important to change the metadata of the .dat file to .xls. Which i dont think possible without proper conversion tool.
Related
Hi I have a question for Matlab programming, I want to ask if I am using Mac OS and I have placed all my audio files in the same folder as Matlab, how do I read all the .wav audio files? I want to automate the process.
Example:
Firstly, I have an excel sheet with the audio file name and information.
Secondly, I want to extract the audio file names from the excel sheet (first column) and put it into the audioread function in MatLab.
I need to use the following audioread function.
[y,Fs]=audioread('audio1.wav');
I want to read audio1.wav and do some calculations on it. After finishing the calculation, I will proceed to read audio2.wav and do the same calculation for it. Can you teach me how to do this and show me the code for this?
Thank you.
In Matlab you can read xls files with readmatrix. You are maybe best to export your spreadsheet of audio files to a csv file first.
With regard to organising the data, it would be easiest for the spreadsheet to contain the full pathname to the file (i.e. /path/from/root/to/file.wav)
So, say you had a audio_files.csv of file paths like
/path/to/file1.wav, file1data
/path/to/file2.wav, file2data
/path/to/file3.wav, file3data
You could read each file with something like
filename = 'audio_files.csv';
audio_file_list = readmatrix(filename);
for audio_file = audio_file_list(:,1) % so long as the first column is the file paths
[y,Fs]=audioread(audio_file);
% do something to y
end
Of course, the % do something to y will depend entirely on what you want to achieve.
Using an existing SSIS package, I was trying to import .xlsx files we received from a client. I received the error message:
External table is not in the expected format
These files will open in XL
When I use XL (currently XL2010) to Save As... the file without making any changes:
The new file imports just fine
The new file is 330% the size of the original file
When changing .xlsx to .zip and investigating the contents with WinZip:
The original file only has 4 .xml files and a _rels folder (with 2 .rels files):
The new file has the expected .xlsx contents:
Does anyone know what kind of file this could be?
It would be nice to develop my SSIS package to work with these original files, without having to open and re-save each file. There are only 12 files, so if there are no other options, opening/saving each file is not that big of deal...and I could automate it with VBA going forward.
Thanks for any help anyone can provide,
CTB
There are many Excel file formats.
The file you are trying to import may have another excel format but the extension is changed to .xlsx (it could be edited by someone else) , or it could be created with a different Excel version.
There is a Third-Part application called TridNet File Identifier which is an utility designed to identify file types from their binary signatures. you can use it to specify the real extension of the specified file.
Also after a simple search on External table is not in the expected format this error is thrown when the definition (or version) of the excel files supported in the connection string is different from the file selected. Check the connection string used in the excel connection manager. It might help to identify the version of the file.
I am trying to read in (MATLAB 7.14.0.739 (R2012a), Ubuntu 12.04, filesize ~2MB) a binary excel file containing multiple sheets but get the following error:
[status,sheets,xlFormat] = xlsfinfo('633933_2014-07-04_11-34-27.xlsb')
status =
''
sheets =
Unreadable Excel file: File contains unexpected record length. Try
saving as Excel 98.
xlFormat =
''
I have a large number of these binary files so I don't want to have to resave them to another format if possible.
The documentation clearly states that the support for xlsb is limited to windows systems having excel installed.
You may try to find some 3rd party so, python or java library which can read xlsb but I am not aware of any. Otherwise you have to switch to a different format.
First post here so if I am doing something stupid, please let me know.
CentOS 7(3.10.0-123.6.3.el7.x86_64), perl5 (revision 5 version 16 subversion 3), Spreadsheet::ParseXLSX v0.16
I have an .xlsx that has some embedded .pdf's and another xlsx in embedded within it. I am trying to read these and insert them into a csv along with the original xlsx. After some googl'ing to no avail my thought was to unzip the original xlsx and read the files from the xl/embeddings directory but, alas there is something with the file that causes adobe reader to not be able to read the oleObject(X).bin files in that dir.
I have been able to successfully read all the worksheets that dio not contain embedded docs using Spreadsheet::ParseXLSX, works great. I have googled for a solution but am either not using correct search prams or ...
If you know how to do this can you point me to some instructions?
TIA,
JohnM
I have a .bin file on my hard drive.
It's recl is nx*ny*4. Its dimensions are (241,121). 241 in x dimension. 121 in y dimension.
How would I convert it using fortran to an ascii file that I can open and read numbers off of?
So, far I have tried
real :: g1(241,121)
open(unit=1,file=gaugemax2010.bin',status='old',
form='unformatted',access='direct',recl=nx*ny*4)
open(unit=5,file='g2010.txt',status='unknown',
form='unformatted',access='direct',recl=1)
read(1, rec=1) ((g1(i,j,),i=1,nx,j=1,ny)
write(5, rec=1) (g1(i,j,),i=1,241),h=1,121)
end
and it has not worked
FORM='UNFORMATTED' opens a file for binary content. For pure text you have to specify FORM='FORMATTED'.
For more details on the OPEN statement see here: Opening Binary Files in Fortran: Status, Form, Access