moqui / moqui-framework

Use Moqui Framework to build enterprise applications based on Java. It includes tools for databases (relational, graph, document), local and web services, web and other UI with screens and forms, security, file/resource access, scripts, templates, l10n, caching, logging, search, rules, workflow, multi-instance, and integration.
http://www.moqui.org
Other
279 stars 200 forks source link

EntityDataLoader only works with CSV if the location ends with ".csv" #554

Open eigood opened 1 year ago

eigood commented 1 year ago

The trailing '#extension.csv' is a hack, to get around the loadSingleFile extension checking logic. In an ideal situation, the resource facade would return a tuple, the contentType+inputstream of the target.

In the following url, key is the random sheet identifier, and gid is the sub-tab(default of 0 for the first tab that is created).

I don't have a patch at this time, as a proper fix would probably be quite a bit of code.

            <script><![CDATA[
                loader = ec.entity.makeDataLoader()
                loader.csvEntityName(serviceName)
                loader.location("https://docs.google.com/spreadsheets/d/${key}/export?format=csv&gid=${gid}#extension.csv")
                loader.load()
            ]]></script>