Import CSV from Doc server into spreadsheet with macro

Do you want to: Ask a how-to question
OS version: Any (Self hosted document server)
App version: Online Spreadsheet Editor
Downloaded from: ONLYOFFICE website

Can you provide a macro example of how to import a CSV file from the Document server into a spreadsheet?

So to be clear, it is not on a known external URL and it is not on a local machine with a known path.

It is not the same as these two examples:

  1. How to import a remote CSV file (using URL) into a spreadsheet: https://api.onlyoffice.com/plugin/macrosamples/importcsv
  2. How to import a CSV from a local file (path known): Use ONLYOFFICE macro to import CSV and TXT data into your spreadsheet | ONLYOFFICE Blog

Hi @Midfield. :wave:
I need some further clarification from you.

  1. Do I understand correctly that you want to add the content of a .csv file to the spreadsheet editor using ONLYOFFICE Docs?
  1. Where do you have the .csv file physically located?

Hi Nikolas

The CSV file to be imported is on the same Document Server as the spreadsheet.
So I do not have a file path or a URL to it.

The use case is:

  1. Another process updates a number of CSV files using the API (this already works).
  2. A macro in a spreadsheet importing these CSV files to process.

The current problem I am trying to solve is how the macro will access the CSV files (located on the same document server as the spreadsheet).

Thanks again

Hello

Another way of explaining, is as follows:

  1. There are a number of csv files and a spreadsheet on a document server.
  2. It is used by a number of people.
  3. The spreadsheet needs to update data from the csv files that are on the same document server
  4. A macro will be used to update the data by importing the csv files, but the macro does not know how to reference these csv’s because they are on the document server.

Is it possible to get a URL or file path for the csv files with some API and then import the files using Ajax?

Hi @Nikolas

Any feedback on this?

@Midfield
We will investigate the possibility of implementing your idea.

Sorry for late response
Such a feature is not available.

If you want to add a CSV file to .xlsx table, you need to have an external URL to the .csv file.

Can the api be used from a plugin to get the path (or a URL) to the CSV on the server?

It seems I may not have fully understood your question regarding the location of the document file on the server.

  1. What do you mean by “document server”?

  2. It’s important to clarify:

The document server itself doesn’t store documents.

The document manager and storage service need to be implemented separately by software integrators who use ONLYOFFICE Document Server on their own server.

The test example provided is a simple document management system that can be integrated into your application for testing purposes.