You can’t; files are immutable, so the replacement file must have a new name. That said, you can name your file like “file-20201101.csv” before uploading if you’d prefer to a different unique rather than the auto-generated “file@1.csv”.
I understand but I need to keep the file name unchanged. Since I only want replace the content of the file and not touch any code line. To have at least a workaround I fork my notebook, delete the file, fork again and upload the new file.
What happens to file attachments when I export? I tried to export a notebook with attached images, but the files did not show up in the resulting tar file and the notebook broke...
Hi, I notice that File Attachments now support zip. It's awesome! No need to import Fil's @fil/jszip! I figure out how to use it, but I notice that there is no official documentation. It might be helpful for other users to find some references here. I'd be happy to contribute if that's the case!
It still doesn't explain what a well-typed CSV is.
For me `.csv({autotype: true})` would be more readable than `.csv({typed: true})`, because there is no such thing as a typed CSV. It might be a bit too late to rename it though.
How does the storage of file attachment works? Are they hosted in your servers? And by which data protection terms does this hosting abide?
Thanks in advance!
Would be nice to add links to FileAttachment API and examples from here.
Every time I use Google Sheet, I search for API docs and land here, but there is no references to https://observablehq.com/@observablehq/xlsx
Can we please make FileAttachment accept a formatted string or a string variable as input? It is very inconvenient having to hard code each file name that we want to use.
This restriction is needed to perform static analysis of notebooks to improve security by knowing which file attachments are in use. If you want to reference file attachments dynamically, you can create an array of them: files = [FileAttachment("1.txt"), FileAttachment("2.txt"), …] and then files[0], files[1], etc.