How do I read data from excel using CAPL - capl

I am trying to read data from Excel sheet which consists of Request and Response, signals with values in CAPL.
How to read from Excel sheet through CAPL scripting?

Only if you save your excel in a csv format. You cannot open xlsx through CAPL.
When you have a csv file, you can read it with the CAPLs regular file operation functions :
openFileRead();
About their usage you will find plenty documentation in Help.

Related

Read Excel file with CSV Data Set Config Element

I'm building a project on JMeter and I would like to read an Excel file with CSV Data Set Config to avoid to use Groovy to read it.
Do you know if it is possible? If not, any other JMeter element can help me to read Excel file row by row?
Many thanks in advance,
Best regards,
CSV Data Set Config is only able to read text files, as per Wikipedia:
A comma-separated values (CSV) file is a delimited text file that uses a comma to separate values.
If your data file is a binary file like .xls or .xslx unfortunately CSV Data Set Config won't help, you have the following options:
Export .xls or .xlsx file to CSV using MS Excel or equivalent
If for any reason you cannot use point 1 you can go for Apache POI libraries to read the Excel file formats in JSR223 Test Elements like it's described in How to Implement Data Driven Testing in your JMeter Test article.
You can also see Busy Developers' Guide to HSSF and XSSF Features for some code snippets for popular user scenarios when it comes to reading/writing data from/to Excel files

How to convert my excel data into JSON with the appropriate formatting?

I am trying to use my own data set for the mind-gapper motion chart reproduced by Mike Bostock at https://bost.ocks.org/mike/nations/
He uses a JSON data file from https://bost.ocks.org/mike/nations/nations.json
I have a data file having food trends in an excel file and I'm wondering what is the best approach to converting excel file into the appropriate JSON format?
How did Mike originally do this? I presume that he had an excel file originally?
It depends on the structure of the data in your csv, but I use online tools like this one: http://www.convertcsv.com/csv-to-json.htm

can we send two types of files in a single flow file in Apache nifi?

I have made a custom processor which converts a Excel workbook in JSON and output it but i want that workbook and JSON both in Output. Is it Possible?
The content of a flow file is just bytes, you could put whatever you want in it assuming that something downstream knows how to understand the combination of an Excel workbook and a JSON file.
A more common approach is for a processor to have multiple relationships, one would be "original" which is where you would transfer the original input to the processor, in this case the Excel workbook, and the other would be "success" where you would transfer the successfully created JSON, and then maybe a "failure" relationship where you would transfer the Excel workbook if you couldn't create the JSON for some reason.

csv to xls using shell

Is there a provision for converting csv file to xls using shell scripting ?
Other answers as mentioned below as it shows all the data with a ',' in a single cell of xls.
cp test.csv test.xls
Other answers as mentioned below as it shows all the data with a ',' in a single cell of xls.
I would say something is wrong with your csv then. I have used csv many a times created via some bash script and it opens properly in the MS Excel as well as in OpenOffice SpreadSheet.
BTW, you don't have to run that cp command. Just Open CSV into MS Excel and it will display it properly. MS excel has full support for CSVs.
If you are still facing this issue, then provide sample data to work with.
You could use ssconvert from the gnumeric package:
ssconvert data.csv data.xlsx

how to read different sheets in a csv file using jmeter?

Am maintaining the data in different sheets in a csv file,but now i wanted to read this through jmeter .
i know how to read single csv file in jmeter , so need help to read different sheets in a single csv file.
Can anyone please help to get solution for this ?
Jmeter only reads CSV so you would need to save each sheet as CSV.
You could try otherwise with a setup Thread group and custom code (Beanshell or JSR223) that takes this excel and extracts each sheet into a CSV file.
CSV file is not created for that : CSV file should contains only one sheet.
As #PMD UBIK-INGENIERIE suggests, export every sheet to an other csv file.

Resources