Excel file upload and choosing columns - ruby-on-rails

I'm building a website which allows users to upload an Excel file. The Excel file may have many columns of irrelevant information, so I want to display an interface which allows the user to select the columns he wants.
Is there already a gem to do this is Ruby on Rails? If not, any suggestions on what APIs etc. to use and how to go about implementing this?
Thanks!

See this answer on SO which I think covers most of what you're looking for: how can I upload and parse an Excel file in Rails?

Related

what is the best way to implement interactive book in c#

I can upload large document as pdf file into web page no problem. but i want to use arrows to navigate the book pages not to upload the whole book at once as this may take long.
can any one help how to do this in mvc app with or without database? if database is necessary would Mongodb be a better choice? i do not want people to download the book; they can just read it online?
First you cannot prevent people to download your content if you visually display it BUT you can discourage them by making it difficult to do so.
That being said you wouldn't have a need a database to do what you want to do. You can but it's not necessary. You can simply find some library online that handle PDF such as iTextSharp cut the book in 1 PDF per page with it when it get uploaded so you have bunch of small files.
Then the trick is simple you query the PDF library to load the file Page1.PDF (arbitrary name) extract text format and output as text nicely has HTML. when the person click the link Page 2 then reload the page with the new PDF to use for display.
Doing so prevent the user from seeing or having access to the PDF file itself and if he want to download it all he will have to copy paste every single page manually or by code if he's a dev. Most common user wont go around copy pasting manually 300 pages because of laziness.
What i would personally do is each file uploaded i would create a folder with the name of the book and call the files 1.pdf, 2.pdf .... per page. Like that if i query the listing of directories i get the list of all books, and if i check the count of files in it i know the total page number. That would allow me to run all that without database.

Importing a large amount of data for testing only.

Here is some background:
I have a client that wants me to test a rails app against a large number of potential inputs in a form page. He has an Excel spreadsheet with about 200 potential input combinations that will be entered into the form.
The client want's the app to be able to "read" the spreadsheet and execute the couple hundred form submissions.
My solution was to just import the spreadsheet into a database table, but the client doesn't want an extra database table in the application.
So here is the question:
Is it possible/not exceptionally complicated to read/crawl a spreadsheet or csv file to do the above, or import data into only the test database?
I haven't been able to find any resources that aren't about simply importing the spreadsheet.
Thanks!
Use spreadsheet gem to read and parse your data from excel.
Use capybara to automate the form submission. Initial learning curve will be steep, but once you get a hang of it, it comes really handy to automate web interactions.
There is a ruby gem called roo which allows you to access the contents of:
Open-office spreadsheets (.ods)
Excel spreadsheets (.xls)
Google (online) spreadsheets
Excel’s new file format .xlsx
Using this gem, you can read test data from file and use them in tests to execute.
Do you have some magical method for importing the spreadsheet into the database already? Because the way I see it, you're going to have to parse the spreadsheet at some point anyway and there's no good reason to add overhead by throwing all of this into a database. Write a script that takes the entries and tries them, submission by submission, that way you won't need to store anything.

How to generate excel report in rails 3 and send it to email

I want to generate excel sheet from data in the database models
I want the feature to custom headings
I want to download from browser
I want to send it to email
Is there any gem for doing this requirement
You can use axlsx gem for generating the xls documents
these are few links
https://github.com/randym/axlsx
http://axlsx.blog.randym.net/
http://rubygems.org/gems/axlsx
May this help you
Try axlsx. It's a very good spread sheet generator.
Downloading and email can be done with Rails. No need for other gem.
I work at Expected Behavior, and we've created a web app called DocRaptor that converts HTML to Excel. DocRaptor is a subscription based product, but we offer a free plan that allows users to create up to 5 documents per month.
Since you mention wanting custom headers, I figured it might be a good fit.
Here's a link to a Switch on the Code blog about using DocRaptor to generate Excel files:
http://www.switchonthecode.com/tutorials/using-doc-raptor-to-create-excel-spreadsheets
And a link to DocRaptor's home page:
http://docraptor.com/

iPad app designing: sync with Excel file

I'm designing a new app for iPad for a small company. This app will use Core Data to store a local database and a database of products and prices. The last database needs to be always up to date since the prices can change.
This company, has a Excel file to keep this database of prices. So they don't have a SQL db to which I can interact from my app.
One option could be to export the Excel file in CVS and put that file in their server (accessible by internet). Then my app should parse the file.
I don't like very much this idea, though.
Do you have any suggestion?
I had a very similar problem to you. I recently got into a project where the client wanted to import information from an Excel file into an app. I know a lot of people say, just transform it into a CSV and parse it that way, but I really didn't want the client to go through yet another step and introduce a different file format - as simple as that may be.
I also really don't like having the information in the cloud, especially Google. Privacy is something that's important to most companies and I'd doubt they'd approve of you using Google to parse the info.
In order to parse the file, I created QZXLSReader. It's a drag-and-drop solution so it's a lot easier to use. I don't think it's as feature complete, but it worked for me.
It's basically a library that can open XLS files and parse them into Obj-C classes. Once you have the classes, it's very easy to send them to Core Data or a dictionary or what have you.
I hope it helps!
Here are a couple of options for you:
Use Google Doc as the intermediary. When the pricing Excel is updated by someone, simply upload the updated Excel to Google Docs. From your iPad app, you can read the latest data via the Goole API. If the company is up for it, they can move to Google Doc altogether and just modify the online Google Spreadsheet directly.
Use services like StackMob as the intermediary. You will have to write a tool to sync the pricing Excel with SrackMob but you can easily access the data via StackMob's iOS SDK.

display excel file content in table after file uploading on same page in struts2

I want to display excel file content in table format, after user upload excel file,
on the same page below file upload form in next div,, will it possible or what can i use for this to achive , with ajax, or
There are quite many ways to achieve this and one of the most easy and flexible way is to use Apache POI.API is capable enough to read and write MS Excel docs.
Foe details refer the official POI site.
Apache POI.
Another solution is to use ZK spreadsheet which is quite easy to use.
Zkspreadsheet.
if its also possible you just load the excel document itself in a frame, iFrame or a popup Most browsers should handle that if Excel is installed on the user's machine.

Resources