Platform
Resources
Pricing
Sign in
Get started
KentR
Workspace
Fork
Published
By
KentR
Edited
Jul 21, 2022
1 star
Insert cell
#
FileAttachment with dynamic filenames
Insert cell
/**
* Returns a FileAttachment from a dynamic filename.
*
* @param {string} filename String containing the name of the attached file.
* @returns {FileAttachment} A FileAttachment object.
* @example
* ```
* const file = "example.csv";
* FileAttachmentDynamic(file).csv()
* ```
*/
function
FileAttachmentDynamic
(
filename
)
{
return
new
Function
(
"FileAttachment"
,
`return FileAttachment("${
filename
}")`
)
(
FileAttachment
)
}
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
FileAttachmentDynamic
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML