Where can I find the path of my excel file in colab? - python-3.x

I upload a excel file in the homepage of colab
However, when I want to read this file in my code, it always shows " No such file or directory" no matter I change the path of file
df = pd.read_excel('/content/drive/My Drive/thesis_bio/0419_combined_biodyes.xlsx', header=0)
How to find the correct path of my file, I check most directory, but havent found yet...

Just connect to google drive from colab if you have not and go to that location where file is present and hover on to that file. You will see 3 dots next to the file, just click on it and you will see an option "copy path", click it and it will be copied to your clipboard.

Related

How to open a file from an absolute path without having to save a copy

So we have our local website to navigate through our drive :
showcase of the website
Here, each button is a link to something on our drive
One of which is a link to a Excel file :
showcase of that specific link
Now, that Excel file contains relative links to PDFs : Relative links inside an Excel
If we click on that button linked to that Excel file from Edge (2nd screen), a prompt appears asking if we want to "Open" the file or "Save as", but the issue is... if we choose "Save as", obviously the links inside that Excel file wont work (unless we save it at the same location), so that's totally normal, the correct option would be to "Open" it.
The problem is that opening a file from Edge... actually doesn't open a file at all, it saves it locally under the AppData path of our machine and THEN opens it.
That means even in that case, the paths inside our Excel file wont work either because they are relative.
I know one solution would be to change all links to absolute links inside that Excel file, but that is a tedious work (because there are a LOT of links, we would have to create a script or something to do that).
So my question is, is there any way to directly open that Excel file from the path specified in the button's link, instead of saving it first locally under "C:\Users\XX\AppData\Local\Temp\MicrosoftEdgeDownloads\f02875af-f436-47bb-b7e5-f3caa96df03f" ?
This is not an issue when using Internet Explorer.
Thank you in advance for any help.
Kind regards,
If you want to allow intranet zone file URL links from Microsoft Edge to open in Windows File Explorer, you can try this Edge policy: IntranetFileLinksEnabled.
Otherwise I don't recommend you to do this, based on the security issues already mentioned.

Find file saved from windows live mail

I use windows live mail. Sometimes I get attachments in
Word, Excel, etc. If I open the document from mail, and hit "save" I can not
find out where it saves. It does not save in any temp file that I can see.
Can anyone please tell me if i can ever get those saved files ?
Please note that this happens when i hit only save.
For Excel File, Open attachment again in Excel from Windows Live Mail.Then I found file location here :
File>Info>Related Documents>Open File Location.
In my case it was on "C:\Users\\AppData\Local\Microsoft\Windows\INetCache\IE\A605094L"
By default this file location will be hidden so you can not find it directly.

How do I write files to my local drive when using Google Colab?

I have a set of data I want to write to an Excel file. I'm using Google Colab, and while I successfully use the following snippet to import files into my notebook...
from google.colab import files
uploaded = files.upload()
...I can't seem to figure out how to write files to my local drive. I'm using the xlwt library to write the data to an Excel file, as follows:
wb.save('Washington_1791.xls')
It completes the task without throwing an error, but I'm not sure of the save location, and I need to get it to save to my local drive. Google gives me lots of suggestions on how to import from the local drive, but not how to save.
Any files written by your Python code will be on the disk of the virtual machine on which the code is running: if you want to get the files to your local disk, you will have to download them explicitly.
To do this, go to the Files tab in the left pane (click the (>) in the upper left to open the pane). Within that file viewer you can right-click any file and choose "Download".

How to save python pptx on colab

Is there a way to save the Python pptx file on Google drive or desktop?
I tried Prs.save() to save the pptx file, but it doesn't work.
Your presentation will be saving to the Files panel on the left of Colab:
From here you can download the saved presentation file.
If you want to save to Google Drive you need to mount the drive (icon is at the top of the Files panel) and then simply append the relevant path to your file name when saving:
prs.save("/content/drive/My Drive/.../presentation.pptx")

How do you check if a file is in use?

I have a desktop application that writes an XML file out. If the XML file is open in a text editor (from a prior running of the script), when Livecode saves the file out, the XML data is not changed.
The actual line I'm using to write the file:
put tOutputData into URL ("file:" & tFilePath)
I can see that using "open file-->write-->close file" logic instead of "URL (file:)" will over-write the data if the output file is already open in a text editor. However, the text editor will show the "old" data until the file is reloaded.
How do I ask the file system if the file is already in use before attempting to write to the file in Livecode?
Check the result to see if there was a problem accessing the file:
put tOutputData into URL ("file:" & tFilePath)
put the result into rslt
if rslt is not empty then
beep
answer error rslt
end if

Resources