observablehq / stdlib

The Observable standard library.
https://observablehq.com/@observablehq/standard-library
ISC License
961 stars 83 forks source link

XLSX file attachments #215

Closed mbostock closed 2 years ago

mbostock commented 3 years ago

This adds support for XLSX file attachments via SheetJS. Similar to SQLiteDatabaseClient, I also chose to wrap the SheetJS API with a more convenient, minimal abstraction.

Screen Shot 2021-05-26 at 7 45 38 PM

I chose not to expose SheetJS as a recommended library (for now). This step is not immediately needed to support XLSX file attachments, and there are multiple versions of SheetJS: we only need the “mini” version for XLSX, but we’d need the much bigger “full” version for XLS.

visnup commented 3 years ago

I think mobile.sheet("Data", {range: 2 /* or 3 or 4? */}) may be what I was looking for.

visnup commented 3 years ago

This is blocked on deciding what to do with dates and times and specifically time zones. We want to translate dates and times to JavaScript Date objects. SheetJS and XLSX both specify "dates and times are in your local time zone." While that might make sense from a "single file on someone's computer" perspective, it leads to a lot of inconsistency in a web environment.

CobusT commented 3 years ago

SheetJS and XLSX both specify "dates and times are in your local time zone."

What happens with csv attachments for dates and times? Does that have the same issue?

mbostock commented 3 years ago

What happens with csv attachments for dates and times? Does that have the same issue?

By default all fields are strings and no dates are parsed. But if you use d3.autoType dates are assumed to be UTC.

mbostock commented 2 years ago

Superseded by #248.