Open Excel files on a remote computer - ruby

I want to programmatically open Excel files on a user's computer, read what is in the first cell, then save this to a mysql db on my webapp with the following info:
cell content (text)
file_updated_date (date)
Is this possible?
Will the user have to install a desktop application for me to open files on their computer, or can I get permission to run a script and return information from a website?
What language or technologies are available to open Excel files, read content, and send to an http endpoint? Is this a Ruby program?

RailsCast is going to be your friend. Learn it, like it, love it. That link should take your straight to his CSV/Excel importing video that can walk you through basically exactly what you're trying to do. As far as reading from the file goes anyways. As for writing back to the webserver, if the webserver doesn't move you can embed the address into your code and work from that. HTTPClient should be able to help you with that part.

Related

Alternative to Windows Alternate Data Streams

I have the following need to implement on Windows: file with files.
Originally I was thinking to use directory with extension. Something like "folderA.myappext", so when user clicks on it in Explorer, my app is launched instead of folder being opened. Unfortunately, I was unable to find a way to do that. Then I tried to use Alternate Data Streams. This works just fine, but several problems with it:
It works only in NTFS, so no way to send it via email or FTP as is;
Only WinRAR can properly archive it, and you still have to do extra clicks in the UI for that;
The real file size (with all streams in it) is not shown in Explorer and does not participate in showing free/used space, which can very quickly lead to big problems for the user.
No, I can't use zip or any other way to combine files into one - this is high-performance app that also requires write streaming (i.e. it changes data all the time).
Any idea how else to achieve my need on Windows? I know on MacOS you can use 'package', but there is nothing like that on Windows. Any idea?
Something like "folderA.myappext", so when user clicks on it in Explorer, my app is launched instead of folder being opened.
You can't do it based on the extension because folders don't have extensions but you can do it with desktop.ini. Windows 7 and later supports custom verbs on folders.
A working example can be found here.

Apple Mail and using Rule to save pdf from url in message

Environment: Mac
Application: Apple Mail
I receive several mails/day that contains an url to a PDF that i would like to save automatically using a Rule, to a specific folder.
I did manage to create a Service in Automator that actually saves the pdf from any choosen mail, but cannot automate this using a Rule. :-(
I've tried several Applescripts but at no success...
So, after 4 days of Google i give up, can anyone help me?
Sincerely/
Erik
If you already have a Service that will do the work, you can write an AppleScript that will call the Service using the automator command line utility. See this previous question for details. Then you can point the Rule at the AppleScript and away you go.

Open a paperclip attached word doc in Ruby/rails

I have a rails app with file attachments using paperclip. Images and pdfs work fine in that if I click on the linked attachment, the image or pdf opens. If I right click, I can do a save-as.
However, with Office files such as word.docx, I can only download the file. If I go do Dos and type the filename, it will open in MS word. Therefore, I think that I should be able to use the system or system call and just pass the attachment name from paperclip (ie attachment.image.url) to dos and the file should open. I think the command I want would be something like
system(attachment.image.url)
I can't figure out how to write the statement to do that.
Your browser will not (and should not) allow you to execute anything outside of the browser itself, this means that without some external app making the call to your Rails app from the clients machine, you will not be able to open the Word doc without downloading it.
You are able to open the images and PDFs in the browser because the browser supports them, but most browsers won't open Word docs.
You can either have the user download the file, or maybe use a third party viewer that you can open the word doc with inside the browser.

SFTP in Sublime Text 3 not working

I'm having the strangest problem.
On a fresh Sublime Text 3 installation, I'm trying to get SFTP (wbond) to function.
I've tried following the documentation, but can't get it to work. I've followed this to a tee, but for some reason my installation acts differently to the same input.
I've installed package manager, sidebar enhancements and SFTP from wbond.
In the linked Youtube video, when he goes to "browse" an FTP server and there isn't one setup, it jumps to a new file automatically where he can input his data. Mine just pastes the content of this file directly into the document I'm in.
If I create a new document, go File > SFTP/FTP > Setup Server... and input my FTP data (that works perfectly fine in clients such as Filezilla) and save, nothing happens.
If, afterwards, I go File > SFTP/FTP > Browse Server... I get a popup asking me to setup a new server, even though I just did.
I feel like I'm not seeing the forest for the trees here, and I'm probably missing something simple.
Any help you can provide is greatly appreciated.
File turns out needs to be saved in
%USERPROFILE%/AppData/Roaming/Sublime Text
3/Packages/User/sftp_servers/
folder.
It can be accessed in Sublime 3 clicking Preferences->Browse packages...

How to download a bunch of files from many links on an open browser window?

Okay, this one is hard to classify for me because I don't know the solution yet.
There are these credit card statements that I have to download from my bank's website, but the crazy thing is that they have one separate pdf file for each month - that's like 60 files for last 5 years - and I need to go through all those transactions!
So, being lazy as I am not to just download them one by one, I was wondering if I could write a script or a simple program that can just download these files once I have the browser window open.
Now the key is this - the program cannot directly make an http call to the bank's website, because this window is behind an account authorization screen, after a few clicks to get to credit card statements. What I want to do, is just open the window, and then run some program, and voila, all the files are downloaded.
And just for some super-kicks, it would be awesome if the program could read those pdf files, parse the tables in the pdf and put them into a spreadsheet or something - if someone tells me how to do that in a few hours, you'll get some serious respect and love.. but even the above should be good enough..

Resources