Python: How to convert .ofx file into .csv - csv

Does any one know how to convert .ofx file in to .csv file. using python language?
I have a file of bank statement which have .ofx format I want to use it in my personal software which support only .csv format.
Please help.

Late to the party, but the python package ofxparse can open and read ofx files. From there, you can consult your transactions and export them as desired.

Not python, but iCreateOFX Basic can convert both OFX and QIF files to CSV (and the other way round.

Related

Nifi processor for converting xlsb to csv

I am trying to convert the xlsb files in Nifi to csv. I am using ConvertExcelToCSVProcessor in Nifi at the moment, but it gives me error and does not work. xlsb are the excel binary files. i have googled a lot and tried to make this work, but in vain. please help in this regard.
I just looked through our code base and checked up on POI. The long and short of it is that XLSB support in POI is fairly limited at this point, and the APIs that NiFi calls don't appear to support it. What you can try as a work around for now is look for a Python library that supports XLSB, write a Python script that generates XLSX or CSV from that and call that with ExecuteStreamCommand.

MarkLogic Java API batch upload files (.csv)

Im trying out the MarkLogic Java API and would want to bulk upload some files with the extension .csv
I'm not sure what to use, since the Java API only supports JSON, XML, and TXT files.
How do I batch upload files using the MarkLogic Java api? Do i convert everything to JSON?
Do i convert everything to JSON?
Yes, that is a common way to do it.
If you would like additional examples of how you can wrangle CSV with the Java Client API, check out OpenCSVBatcherExample and JacksonDatabindTest.testDatabindingThirdPartyPojoWithMixinAnnotations. The first demonstrates converting the csv to XML and using a custom REST extension. The second example (well, unit test...) demonstrates converting the csv to JSON and using the batch upload (Bulk Writes) capabilities Justin linked to.
If you have CSV files on your filesystem, I’d start with mlcp, as suggested above. It will handle all of the parsing and splitting into multiple transactions/batches for you. Take a look at the mlcp documentation for more details and some example configurations.
If you’d like more control over the parsing and splitting logic than mlcp gives you out-of-the-box or you’re getting CSV from some other source (i.e. not files on the filesystem), you can use the Java Client API. The Java Client API allows you to efficiently write batches using a WriteSet. Take a look at the “Bulk Writes” example.
According to your reply to Justin, you cannot use MLCP because it is command line and you need to integrate it into a web portal.
Well, MLCP is released as open cource software under the Apache2 licence. So if you are happy with this licence, then you have the source to integrate.
But what I see as your main problem statement is more specific:
How can I create miltiple XML OR JSON documents from a CSV file [allowing the use of the java API to then upload them as documents in MarkLogic]
With that specific problem statement:
1) have a look at SplitDelimitedTextReader.java from the mlcp source
2) try some java libraries for this purpose such as http://jsefa.sourceforge.net/quick-tutorial.html

Converting Tab Delimited txt to JSON

I have a 1.9GB tab delimited file that is in the form of an xlsx file. I could write a script to convert it to CSV and then convert THAT to json, but I'm just curious if there is a more direct way to do this. Thanks! :)
Not sure if this is an option, but you can import it into some database (for example mongo) and then export relatively easily with that
I came accross a similar problem recently, and what I found really easy to do was actually go directly from XLSX to JSON using MATLAB.
IMPORTING XLSX: https://www.mathworks.com/help/matlab/ref/xlsread.html
EXPORTING JSON: https://www.mathworks.com/help/matlab/ref/jsonencode.html
It might take a little bit of time for such a large file, but I did it on a file about 400MB in size with no problem.

How to convert sas7bdat file to csv?

I want to convert a .sas7bdat file to a .csv/txt format so that I can upload it into a hive table.
I'm receiving the .sas7bdat file from an outside server and do not have SAS on my machine.
Use one of the R foreign packages to read the file and then convert to CSV with that tool.
http://cran.r-project.org/doc/manuals/R-data.pdf
Pg 12
Using the SAS7BDAT package instead. It appears to ignore custom formatted, reading the underlying data.
In SAS:
proc format;
value agegrp
low - 12 = 'Pre Teen'
13 -15 = 'Teen'
16 - high = 'Driver';
run;
libname test 'Z:\Consulting\SAS Programs';
data test.class;
set sashelp.class;
age2=age;
format age2 agegrp.;
run;
In R:
install.packages(sas7bdat)
library(sas7bdat)
x<-read.sas7bdat("class.sas7bdat", debug=TRUE)
x
The python package sas7bdat, available here, includes a library for reading sas7bdat files:
from sas7bdat import SAS7BDAT
with SAS7BDAT('foo.sas7bdat') as f:
for row in f:
print row
and a command-line program requiring no programming
$ sas7bdat_to_csv in.sas7bdat out.csv
I recently wrote this package that allows you convert sas7bdat to csv using Hadoop/Spark. It's able to split giant sas7bdat file thus achieving high parallelism. The parsing also uses parso as suggested by #Ashpreet
https://github.com/saurfang/spark-sas7bdat
If this is a one-off, you can download the SAS system viewer for free from here (after registering for an account, which is also free):
http://support.sas.com/downloads/package.htm?pid=176
You can then open the sas dataset using the viewer and save it as a csv file. There is no CLI as far as I can tell, but if you really wanted to you could probably write an autohotkey script or similar to convert SAS datasets to csv.
It is also possible to use the SAS provider for OLE DB to read SAS datasets without actually having SAS installed, and that's available here:
http://support.sas.com/downloads/browse.htm?fil=0&cat=64
However, this is rather complicated - some documentation is available here if you want to get an idea:
http://support.sas.com/documentation/cdl/en/oledbpr/59558/PDF/default/oledbpr.pdf
Thanks for your help. I ended us using the parso utility in java and it worked like a charm. The utility returns the rows as object arrays which i wrote into a text file.
I referred to the utility from: http://lifescience.opensource.epam.com/parso.html

How to covert mysql to excel file using php?

I am just wondering what's the most efficient way to export mysql data to excel file using PHP. I have been searching on web but not sure what the best way is. Any thoughts? Thanks for help.
You could try this PHPExcel - OpenXML Api: http://www.phpexcel.net
I never tested that, but the feature list says that it can export data to
Excel 2007 (spreadsheetML)
BIFF8 (Excel 97 and higher)
PHPExcel Serialized Spreadsheet
CSV (Comma Separated Values)
HTML
PDF
Good luck!