Export from Google spreadsheet to XML

I have a google docs spreadsheet and an XML file that is generated from this spreadsheet. Now I need to speed up the export of information in XML format. So I switched to Google scripts.

Currently, I can get specific cells from a spreadsheet and create string variables, however, I need to save the resulting rows in an XML file using a minimal number of clicks.

Is there a way to instantly make an xml file using google scripts and send it to download from a browser? The only way to save the result that I found is to create a simple text document in the folder with the Google drivers by opening this document and manually copying its contents into my XML file. But it seems that these text documents do not understand tab characters (\ t), and I need them to create a specific structure in my xml.

+6
source share
2 answers

Have you viewed the Content Service ? You will generate XML and serve it through the Content Service, set the mime XML type, and then use downloadAsFile to tell the browser to simply download the file, rather than displaying it.

+6
source

The ContentService lets you have granular control over exactly what you want your XML to look like. You can also let Google create an Atom / RSS XML feed for you by posting it.

In the old sheet, the publish option allows you to export XML. (No longer supported.) Here's a sample XML .

+1
source

Source: https://habr.com/ru/post/921408/


All Articles