Most efficient way to handle xlsx / xls input in spring batch - spring-batch

I have to write a spring batch program which should handle excel input.
Is there an itemreader present for excel files.
Special case: What if I am unsure about the input format of the file. It could be any of xlsx or xls and the program should be able to handle both.
Solution I have in my hand: Read excel using poi or jexcel and write into a dat file which could then be processed using FlatFileItemReader.

Write your own ExcelFileItemReader implementing ResourceAwareItemReaderItemStream interface and use poi/jexcel libraries there.
Don't forget to look at FlatFileItemReader source code.

Related

Import data from bpmn file into one string/char value Matlab

I have a consistent bpmn file (similar to xml file) and i would like to read it with matlab and store the all file data in one string or char attribute. I have tried with textread(file, format) but the best i can have is a 2358796x1 char and then assemble each line to recreate the file but it's a very long process.
Is there another function to do this ?
Thanks for helping.
You can use this xml2struct.m function, to read xml files and convert all the content to MATLAB struct variable.
Newer versions of Matlab ship with an xmlread function. Have you taken a look at that?

Perl parse an .xlsm file without using excel

I have an input .xlsm file from which I have to parse some values.
Currently I am using Win32::OLE which from certain reasons I need to stop using.
Is there a way to parse that file without using EXCEL processes?My searches on google lead me to Spreadsheet::ParseXLSX module and Excel::Writer::XLSX(with some problemes), but I don't know whether they require Excel or not.
Thank you!

Importing data from text file and saving the same in excel

I am trying to read data from text file (which is output given by Tesseract OCR) and save the same in excel file. The problem i am facing here is the text files are in space separated format, and there are multiple files. Now i need to read all the files and save the same in excel sheet.
I am using MATLAB to import and export data. I even thought of using python to convert the files into CSV format so that i can easily import the same in MATLAB and simply excelwrite the same. But no good solution.
Any guidance would be of great help.
thank you
To read a text file in Matlab you can use fscanf or textscan then to export to excel you can use xlswrite that write directly to the excel file.

Create Excel file in iPhone programmatically

I want to create a Excel supported file which contains strings and images programmatically. I tried to create a .csv file, but I am not able to .csv file with both string and image.
There are many possibilities. The easiest way is to create CSV-Files but you have to take care which seperators excel uses. For checking that you should create a spreadsheet in excel and save it as csv and take a look into that file using any text-editor.
Another approach is to use SpreadsheetML and here a link to the msdn XML Spreadsheet Reference
Otherwise just create a simple xlsx-file with excel, unzip that file and take a look into that the unziped files.

How to most effectively automate repetitive Excel task?

I want to automate Excel using Perl to do the following task(s):
For a list of Excel .xls files, do the following:
Open the file
Set Format to CSV
Save the file under the original filename and directory, but replace the extension "xls" with "csv"
Close the file
End
I found how to open files, even how to save them. I did not find how to change the fileformat/save as a different format. There shall be no user dialogs popping up, it should be fully automated. The Excel file list I can generate myself, a parameterized "find" or maybe "dir" should suffice.
If you are using Excel automation a great help is Excel itself. Use the VBA environment (Alt+F11) to get help for the Excel objects you want to use.
The objectbrowser (F2) is very valuable.
Workbook.SaveAs([Filename], [FileFormat], [Password], [WriteResPassword], [ReadOnlyRecommended], [CreateBackup], [AccessMode As XlSaveAsAccessMode = xlNoChange], [ConflictResolution], [AddToMru], [TextCodepage], [TextVisualLayout], [Local])
Searching for CSV in the object browser will show Excel constants with their values, since you probably cannot use these Excel constants in Perl.
See Spreadsheet::ParseExcel and xls2csv, they will help you.