Any means of autoimporting CSV files into Calc?

In ten years of using the Libreoffice Calc I have always just clicked through the CSV import dialogue without ever having to change a single setting. I understand that under certain circumstances that would be necessary. It seems like having to enter that dialogue would be an exception, rather than the rule.

This feels like something that could be done automatically. Currently, I regularly need to import CSV files, and never have to touch the import settings to get the data to enter properly. Maybe, there’s a means of auto importing if the file meets certain qualifications, and the dialogue pops up if those qualifications are not met. That sounds a bit more grand in scope and bug prone. However, a toggle for autoimporting seems simpler to implement, and can just be turned on and off if a specific file needs it. Either that or adding an API desktops can use to call “import as”, rather than the “import” function called by default.

Is there a toggle for just auto importing CSV files? Is this a feature that could be easily added?

That is tracked in tdf#74580.

There are thousands of different flavours of valid csv out in the wilderness and an application like LibreOffice needs to handle each of them adequately.
Your import settings never change. So you open a csv file and hit Enter when the dialog pops up. Do you want to save the single stroke on the Enter key?

No. But you could create a macro with your settings.

Yes, but endless threads here show: Thin would not make the problem go away
 Even now a lot of users do wrong imports. Not even asking them will move this threads to “Why has LO this done wrong”, instead of focus on “How to import correctly?”

Already done: All csv-files need checking by an intelligent person regarding date-format and charset.

Well, Excel does it. There is clearly a solution that works for 99% of the world population. If someone needs the alternative import there always is the import as solution, which is what Excel does. If someone needs the alternative all the time a yaml or some other config file should easily be able to change the default value.

My understanding is it depends on the language the person uses. You just use a heuristic based on region and the solution works for the vast majority of people. That’s why there should be a config file for handling minority use cases, while having sane defaults based on region, which is what every other text editor does. Most people would probably switch from Microsoft products to Libreoffice if a solution was implemented for these issues.

Yes, that adds hours of work. It’s a UX issue. Users typically open their file and then go back to whatever other program their working in while waiting on the file to open. It adds a bunch of five second to 3 minute interruptions to workflows that add up over the course of a month.

I probably have about 100 files I need to constantly be opening and closing. So, assuming five seconds to 3 minutes that’s an extra 8.33 minutes to 300 minutes just to open the files once. That’s not including having to open them multiple times.

You really think 99% of “world population” speaks english?
.
You are the problem then. In my countrybI have to deal with lokal date formats, iso standard dates and software wich is set to the country of the manufacturer.
.
MS is another “problem”. There were times when csv files written in the DOS-box had other charsets than Windows on the same computer (for “compatibility”).
.

Excel ignores the problem and leaves it to you to solve it later.
I still have old scripts wich avoid the extension .csv in favor of -csv.txt so the files were not opened by Excel. (Excel didn’t recognize the separator being ; instead of , so imported files were useless.)
.
Essentially the Excel idea was “Give me, what I expect, then everything is ok.” This solves nothing.
.
And my honest advice is: If Excel is what you need, use it. There is nothing to excuse for, if MS has the software you like. (But please check your figures: I doubt there is 99% English/Windows/Excel now
)

1 Like

English is the lingua fraca, so it should receive priority. What I’m saying is the major languages in use can easily be supported through a heuristic identifying the CSV format they use. You then have a config file for allowing minority populations to autoimport their files, and have “import as” as an option for when someone rarely needs to import a file not in their native format. I really don’t see why this is such an intractable problem for Libreoffice to solve through config files, when there’s a workaround that auto imports for English speakers. I’d assume there’s also a similar workaround that just works for non-English speakers of major languages.
.
Or even better yet, after someone imports their first CSV save that as the config file used for all other CSVs by default. You could use LUA or YAML to support multiple selectable default import rules.

Sorry, but you obviously have no clue. (And don’t know what’s done “easily”).
.
The point is not language. Canada, South Africa and Australia use other settings for dates (and sometimes more than one at a time). Names are not translated, so what do you do with Jörg Ångstrom and the other letters like Ă©, Ăą, ñ 
I import data about international art, and believe me: There are no rules wich artist didn’t break. There is no heuristic wich can tell you if a file contains US$, € or £ ( and I’m old enough to have used printers wich printed £ for $). So, if you wish to repeat history I wish you good luck.

I wouldn’t mind to give you two options:

  • I know what I’m doing. Import this always on some default settings. Never ask me.
  • I have no clue what this is about. Do as you like and never ask me anything.

But maybe you will need a programmer for this. And don’t expect a software wich was developed originally in Europe/Germany to have your defaults.

IMHO we should not waste time with using csv. If possible I ask for downloads in xls/xlsx, wich avoids most of my problems. (But even there are problems lurking, if banks set all fields to text for local dates or are hiding database reports in html inside xls, just because Excel can handle this silently.)

1 Like

Create a macro and attach that function to the document loaded event. In the macro, you can define a folder from which either all or optional .cvs files will be loaded. Create an icon on the desktop from this basic document, so every time you double-click the icon, all the .csv files you defined in the macro will be automatically loaded into the Calc app.
You can then test how many .csv you can load ‘simultaneously’ to Calc before it crashes
 :wink:

I don’t know. The solution Excel implements seems to work for everyone doing accounting across the world. Microsoft has a heuristic that identifies all of those exceptions you mention. Libreoffice Foundation could just decompile their code and segregate teams to implement their solution legally. Either that or developing a configuration scheme using YAML would make sense. Would probably be able to support a ton of features over the long term with refactorings.
.
I just think once the import dialogue is run once there could be a toggle to save as the default. I’ve written my own YAML files for importing various data schemes in the past for my own programs. This seems like something YAML types could solve for users. Either that or Libreoffice Foundation’s preferred config file.
.
The issue also applies to other import dialogues, like html. It sounds like all of this stuff already has code for handling manually. I just don’t understand why there is opposition to supporting config files for this that allow users to change their default import behavior back and forth by having lists in a dictionary.

This delimiter problem can be easily solved by adding a function to the macro I described earlier in this thread. You can open the .csv first and easily replace both the column and row delimiter with an inbuilt function, and then save the file, and then load it to Calc. It takes its time of course, but only one time. Meanwhile you can take, for example a coffee break. Once when done you can comment out those lines from your code (for possible later need).

Now when you’ve done this, you can build a dialog of which help a settings file can be created for the macro to use. Now when this has been done, you can sell your tuning to all those non-English speaking individuals in the world (1% as you mentioned results 80 million potential buyers) and become rich


Your first 3 words are correct:

https://answers.microsoft.com/en-us/msoffice/forum/all/microsoft-excel-corrupts-data-in-csv-files/8337e85c-b1f5-4e99-9ca4-1ab51ae2984e

It’s not an issue at all.

The csv import options are stored in your profile. Simply hit Enter to confirm the settings you applied last time.

This delimiter problem can be easily solved by adding a function to the macro I described earlier in this thread.

I solved my issue by implementing a custom desktop file for importing CSV with default values for English. I really do not see why a config file would not work for the majority of users for their data import schemes. It’s very easy to have a YAML file with a list of different import schemes depending on what’s being implemented. Could be abstracted and work for importing other file types as well.
.
Before importing the user configures the import scheme desired for data from that organization, and can change it if needed for other organizations. Something similar would still apply for other file formats. I mean VIM supports stuff like this for all sorts of files in Vimscript.

Not saying there are not problems. It just seems like settings that could be saved per user based on the data they’re working with.

Why should I be doing that every time is my point if Libreoffice already knows my last import settings, which were the default setting Libreoffice gives me. Multiple CSV files from different companies, and different websites all import the same for me.
.
This is largely whey I believe Libreoffice should implement shares using cryptocurrency and their end users could then vote on where funds get directed for development. This sounds like a feature your users want, which would increase shareholder value.

feel free to contribute to the real world : https://community.documentfoundation.org/t/update-on-budget-2024/12219

and again :

All crypto is is a means of issuing financial products without involving an intermediary. It literally lowers the cost for issuing shares and bonds, while reducing the cost of capital allocation in the process through automating financial institutions. It makes sense for a lot of open source projects to move towards this to receive funding by investors looking to receive ROI. Open source is extremely capitalist friendly.
.
I’d give money to fund features I think would make LIbreoffice more competitive against the Microsoft software stack if I could receive ROI. I’m honestly, more likely to fund a fork of Libreoffice as I think the management behind it has problems.
.
I really do not understand why a large group of developers using Libreoffice are opposed to developing a means of autoimporting. Especially, when large corporations, like the big four standardize how their spread sheets are formatted. I’m pretty sure having to go through that import window is the minority of use cases for spreadsheets, after doing it once. Especially, in the English speaking world, and the majority of countries with large populations and high GDPs.

Just a troll.

1 Like

It’s clearly a problem with a solution as mentioned here.
.
I don’t understand why there’s so much resistance on this one particular issue for improving UX. If a file gets imported incorrectly on those edge cases they could just go through the dialogue.