Narigo
Narigo•11mo ago

Recommendations for interacting with Excel sheets (.xlsx) and GraphQL?

I want to use Deno in production. Specifically, I'm looking into building a script that reads a .xlsx file and pushes some data to a GraphQL server. Is there a recommendation on what packages can / should be used? I've recently tried to set up Prisma, but that totally failed and to get it to work with Deno seems like a big workaround and a big time invest to understand what's necessary. So I hope my other script idea is going to be easier to implement or will I have too many compatibility issues again trying to use Deno with Excel sheets or GraphQL...? 😬
3 Replies
razzi
razzi•11mo ago
Using .xlsx directly is somewhat unusual; I'd recommend first importing the spreadsheet data into a relational database such as Postgresql. From there it will be easier to access from the GraphQL server. To be honest, I know this is a Deno server, but it may be easier to import xlsx data using Python and Pandas, which has methods like https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html
razzi
razzi•11mo ago
If you're set on using JavaScript, you may have success with a similar DataFrame library such as Danfo.js: https://danfo.jsdata.org/api-reference/input-output/danfo.read_excel
danfo.readExcel
Reads a JSON file from local or remote location into a DataFrame.
Narigo
NarigoOP•11mo ago
I want to parse the Excel data into a PostgreSQL database with the script. I do need to process the data a bit, though: Remove some columns, streamline cell values, etc. before putting it into the database. The devs who are going to maintain this shouldn't need to work with different language contexts, so the language is basically set to TypeScript. Since the database is going to have a GraphQL frontend through Hasura, I wanted to check whether I can use that frontend to update the database itself. As I mentioned, I tried getting Prisma to run to work with the database directly, but that didn't work out too well and I'd like to have something that works with some type safety instead of writing raw SQL statements I managed to get SheetJS to run with Deno and I think I'm going to use that for now. The Danfo.js looks like it's tailored more to calculations on the values where I'm going to need to work with strings mostly and getting those streamlined