Link to External Data using URL to CSV file - csv

I am using OpenOffice Calc 4.1.1 on Windows 7.
I am trying to use Link to External Data to load an external CSV file from a gaming website Wowuction.com. If I open the URL in my browser I get a CSV file saved to disk. But when I use that exact same URL in the "URL of external data source" box and hit enter, there is a short pause like its loading, but then nothing happens. Nothing appears in the "Available tables/ranges" box, the OK button is still disabled.
Does OpenOffice Calc not support CSV as an external data source?

In short: Calc doesn't support loading a CSV file externally, only HTML, ODS, XLS, maybe another.
But if you are confortable writing a dos script, you can download the CSV file and convert it to HTML continuously. Then you can just direct the 'Link to External Data' to you local HTML file.
It's been done on ubuntu linux, in case you want a little reference.

Related

Is there a good alternative for embedding a PDF with HTML next to using a local file path, online file path or data source as base64-string?

I am building a web app and I would like to show PDF files to my users. My files are mainly stored as byte arrays in the database as they are generated in the backend. I am using the embed element and have found three ways to display a PDF:
Local file path in src attribute: Works, but I need to generate a file from the database byte array, which is not desirable as I have to manage routines to delete them once they are not needed anymore.
Online file path in src attribute: Not possible since my files may not be hosted anywhere but on the server. Also has the same issues as the previous method anyway.
Data as base64 string in src attribute: Current method, but I ran into a problem for larger files (>2MB). Edge and Chrome will not display a PDF when I covert a PDF of this size to a base64 string (no error but the docs reveal that there is a limit for the data in the src attribute). It works on Firefox but I cannot have my users be restricted to Firefox.
Is there any other way to transmit valid PDF data from a byte array out of the database without generating a file locally?
You have made the common mistake of thinking of URLs and file paths as the same thing; but a URL is just a string that's sent to the server, and some content is sent back. Just as you wouldn't save an HTML file to disk for every dynamic page on the site, you don't have to write to the file system to display a dynamic PDF.
So the solution to this is to have a script on your server that takes the identifier of a PDF in your system, maybe does some access checking, and outputs it to the browser.
For example, if you were using PHP, you might write the HTML with <embed src="/loadpdf.php?id=42"> and then in loadpdf.php would write something like this:
$pdfContent = load_pdf_from_database((int)$_GET['id']);
header('Content-Type: application/pdf');
echo $pdfContent;
Loading /loadpdf.php?id=42 directly in the browser would then render the PDF just the same as if it was a "real" file, and embedding it should work the same way too.

Downloading/Opening .csv file using Google chrome, it changes extension of .csv file to .xls

I have an a tag in my html file that is pointed to a .csv file. Every time I click on the link it downloads the same file in .xls extension. Why?
I tried the following:
File download
<a href="./example.csv" download>File download</a>
File download
File download
I tried to open the file with the file:///myfolder/example.csv protocol but all of these had the same outcome.
Whereas in Firefox, IE, Edge this downloads the file in .csv extension.
How can I get chrome to download the .csv file in the .csv extension?
Locally on Windows 10 machine Google Chrome downloaded .csv file with .xls extension. But when I uploaded the same project to GitHub Pages, Google Chrome started downloading file with correct .csv extension.
So the solution is either in webserver settings or just to test outside of the local environment.
Have you tried supplying a value to the download attribute, like this?
File download
That may be enough to force the server to download the file as you expect. Also, try removing the "./" from the href attrbute of your a tag.
If you'd like to know more about the download attribute, check this link.
I didn't find any solution for it so I have made a work around:
if (fileType === 'text/csv') {
FileSaver.saveAs(newBlob, `${data}.csv`);
} else {
FileSaver.saveAs(newBlob, `${data}`);
}
This is working for me, if you find that browser makes the same issue for any other file and this file is not csv, try to implement it like this and it will also work.

Load local image, modify it and save back to same file

File input allows user to access a local file from browser. Is it possible to load a local file given by file input, modify it and save it back to same local file? I know that HTML5 allows creating writeable filesystem, but basically it seems to be abstract directory.
For security reasons, I don't think the browser can overwrite the local file. Using the File-System API you could only copy the contents of the local file to the sandboxed File-System API directory(found under various obfuscated file names). All manipulation/saving would be done in AppData.
Perhaps displaying the modified image on the screen, right click, save-as to the given file location would also be suitable? (other than that I think you have to upload the image to a server and download it back again)

HTML 5 - load text from text files

I am facing problem in HTML 5. I need to statically load data into web page from local saved files. Up to now, I have been only able to load data via < input type="file" id="fileinput" / > but I want to load data from static location, which never changes. How to do that? And is there any way how to determine, whether some local file was changed from previous version?
Thanks
no, this isn't possible if by 'local', you mean a file at /home/waypoint/somefile.txt. You can make a 'link' with the filesystem api (if you selected it in an input field, for instance), which is valid to do computations with it (to read it, write to it, display it in img,etc). But it is deleted/unvalid, as soon as the window closes. If you could just magically "read" any local file via javascript which resides on the file system, who would stop google to read out your /etc/passwd file?
if your local computer is also your server and therefor your server-side code has access to the local file /home/waypoint/somefile.txt, your app can get it via ajax. Checking if the file exists, would be done the same way.

Trouble opening .csv files on my Mac

I am trying to open a .csv file in my Mac, using Excel 2008. Currently, every time I try opening the file, my Mac defaults to OpenOffice.org 3. I never had this problem. I always used to be able to open csv files with Excel.
Where do I go to change the default spreadsheet program for opening csv files back to Excel?
Thank you.
CTRL+Click or Right Click on the CSV file, click on "get info" option. In the popup at the bottom under "opens with", select the application you want to associate with this file e.g. excel.
This works for changing the file associations for most files.