Hacker News new | ask | show | jobs
by acesubido 2646 days ago
> If not, my maker soul asks: maybe there should be one? Maybe I should build one? Would you consider using this kind of service in your applications if one exists? Why not?

To answer your "maybe there should be one?" question. What you're describing sounds like this: https://flatfile.io/. It was shared here 2 months ago.

Though to answer your original question:

> How do you handle Excel import/exports in your apps

One way we go about that is: whenever someone uploads a file, create some sort of UploadRequest record which contains the filepath in S3/Azure/GCS/etc. Then the actual parsing and validation is spun off in a worker process. That way the web process isn't locked and we can pub progress ((processed_rows/row_count).percentage) on authorized subs. If that worker process ends, update the UploadRequest record status and dump the array of good_rows/error_rows in some column for that record. Users see that the status for that UploadRequest is updated, then they can review the UploadRequest errors. If there are errors, they download the uploaded file, fix that and re-upload again. At the start you can also provide a template to "gate" your upload, if it doesn't match your template you blow up UploadRequest with the proper error. If all is good, they click "Process" or something, which actually inserts the rows or does whatever.

Again, that’s just one way.

If bizdev asks to make a feature that allows fixing those rows in your app without leaving the browser, we find that it slowly feature creeps into Google Sheets territory, which is a BIG undertaking and a separate feature on it’s own. It's a nice experience to do in-app editing but we try to see if most of our Excel uploaders would prefer to go back to Excel for editing. Sometimes we find that they’ll prefer going back to Excel because they’ll use the same excel sheet for other purposes in their process (send that Excel as an email to another department, use that and aggregate it as a separate report, etc.).

But really, the hardest part in Excel uploads isn't server resources, progress, file encoding, or timeouts, it's the validation. There are different levels of validation: from presence checks, formatting, type-checking to running a row or a cell against business logic, 3rd-party API calls or records in your database. This is where most User errors arise, because you'd have to educate them on what values to put if you're referencing something in your business logic (special abbreviated codes, special combination of codes, date formats, etc.).

2 comments

Small question, since the developer docs are not available on mobile devices:

When the flatfile.io homepage keeps referring to "XLS" docs, is it actually trying to say they will import modern Excel files ("XLSX") or does it literally mean you would have to ask users to re-save their spreadsheets into the ancient format?

Yes, this is also the process we're taking on and it seems pretty complex for me. But anyway, flatfile.io is probably answering my all question best. Thanks for sharing!