I am using Angular's ngCSV directive to export my json array into a CSV file. I have to export multiple csv sheets as a single CSV file. Please let me know how to get this using Angularjs or pure javascript?
It depends on your data. Find a way to join (Array.concat) your data before passing it on to ngcsv.
Without any example, I can only give you a generic answer.
Related
I am demanded to define a schema for a CSV file using Mongoose, but after I peeked through the CSV file, I found there are almost a hundred fields or columns in the CSV file. I know how to define a schema in Mongoose using only a few fields, but I am totally unsure how to define such schema. Is there an efficient way of doing that, such as reading through the head of the CSV and copy those heads into an javascript object and then pass the object to the mongoose.Schema()
Using this package https://www.npmjs.com/package/csvjson you can convert csv file to JSON.
Then secondly, you can convert the generated JSON to mongoose schema using this package, https://github.com/topliceanu/mongoose-gen.
You may need to edit the field types. I hope it works for you.
I'm using this code (http://blog.darrenparkinson.uk/2014/04/accessing-cisco-administrative-xml-axl.html) to make connection with CUCM.
But, this code returns the XML in console. I need a XML file or .CSV file for open in Excel.
How can I do this?
Tks
Are you trying to get a list of all the Route Patterns on the Call Manager? etc. I guess this should help:
https://medium.com/#chandupriya93/xml-to-excel-conversion-using-node-js-d70296ba3bea
This uses an xml2js and json2xls module to parse the XML file into a JSON file and finally convert into XLS.
Hope this helps.
Ank
Another choice is camaro. You can take the element you want as an array easy. then convert that to csv
You can see the sample in that package
There is one requirement in javascript to export the data (array or array of objects) to excel xlsx. I already exported the data to csv but unable to do same for xlsx. I tried many api from github so that I can used the libraries and export it to xslx but there are little help for it. I tried using stephen-hardy/xlsx.js, SheetJS/js-xlsx etc.
For exporting to csv I used this Click here! but the same cant be done for xlsx.
I tried xlsxwriter also to convert and write javascript array or array of object to xlsx but no result.
Now I m badly stuck because of the requirement. I also found out the similar post as of mine requirement Click here!
Please guys give me solution if any
A while ago, I wrote the following article, which described how to export data from a jqGrid to a "real" .xlsx file:
Export jqGrid to Excel
This basically cached the jqGrid's data into a JavaScript variable, posted it back to a server, to save into Excel. The Excel file is created using the OpenXML libraries.
This should point you in the right direction.
Alternatively, you might like to try this library:
AlaSQL
(I haven't tried this though.)
Try excelbuilderjs, I have done the same of downloading a Json Object with array of items into an excel sheet using this library.If you can please share the code on Jsfiddle, i can take a look at it and help you out
http://excelbuilderjs.com/
It seems all the D3 example graphs take an external .csv or .tsv file as input data. Is there any way to modify the code to take data from a variable in Django. Suppose {{ data }} is in JSON format, how do you implement this in a graph such as http://bl.ocks.org/3885304 or http://bl.ocks.org/3887051 ? I'm trying to avoid always writing a .csv file.
You can always make a view which will serve dynamic csv file which will be consumed by D3. This way will also allow users to download the data in case they need the raw data instead of a graph.
def foo(request, ...):
model = get_object_or_404(Foo, ...)
data = model.get_data() # should return csv formatted string
return HttpResponse(data, content_type='text/csv')
Instead of loading data asynchronously (ajax-style), you can use correctly formatted JSON in a string passed to your template tag variable and |safed.
Check out the working example http://bl.ocks.org/4040034 which is based on http://bl.ocks.org/3885304
You should also check out the related questions on SO, there are tons on the subject.
I´ve a Javascript object with all the data that I need to store on xls file. What could be the better way? Apache POI? Jasper-Reports? I´m not sure about the correct choice.
Thanks!
If you just need to import it with Excel I would suggest creating an CSV file out of the data instead.
This can easily be done with JavaScript and Excel can import that format.