Getting file contents?

Hey so I’m looking to get the contents of a file (it’s a .md file), and display it on a widget.
I was told to use the wg function, so I put the path into that, used raw, and it’s not returning anything.

Am I doing this correctly, or should I be doing this another way?
Thanks!

Here’s what I’m using rn:
$wg(“/Internal storage/Obsidian Vault/Lists/Tasks/General TODO.md”, raw)$

First, I suggest moving the file inside the Kustom folder to avoid any access issues. After doing that, use the format from the sample below.

$wg(“file:///Kustom/testfile.txt”,raw)$

Hmm ok, so from what I’m understanding is it can only be a .txt file to get the raw data, or can I get a .md file as well?
(It’s not encrypted or anything, just markdown format)

Also I cannot move the file outside the current location since it’s synced in a specific place from a 3rd party app.
Can I use an absolute location?

Thanks!

If this is a markdown file, it should be compatible. As for the location, there’s no guarantee it’ll work outside the Kustom folder. This is due to Google’s change in storage access policy.

Hi there,

In addition to Ace’s reply…

You can use $wg("file:///…", raw)$ to retrieve the file as it is or $wg("file:///…", txt)$ to retrieve the file as plain text.

I hope this would help.
:smiling_face::+1:

2 Likes