I have a google docs spreadsheet and an XML file which is made on the base of this spreadsheet. What I need right now is a way to speed up exporting information to XML format. So I've turned to google scripts.
I can currently retrieve certain cells from a spreadsheet and make string variables, however I need to save the resulting strings to an XML file using minimum amount of clicks.
Is there any way to instantly make an xml file using google scripts and send it to download from the browser? The only way to save the result I've found is creating a plain text document in google drive folder, opening this document and manually copypasting it's content to my xml file. But it seems that this plain text documents do not understand tab-characters (\t) and I kinda need them to make a certain structure in my xml.
How to convert a XLSX to a XML file? Choose the XLSX file that you want to convert. Select XML as the the format you want to convert your XLSX file to. Click "Convert" to convert your XLSX file.
Choose tab and export data Under the Export data section, click Select data. As you can see below, our open file is automatically selected. Now, choose the tab you wish to export. In this example, I want to export Garry's performance data, so I'll select his tab.
Open any google spreadsheet and go to Add-ons in the page menu and click on Launch. Click on the XML integration. Add a Name to the XML query and add the XML data source url in the Data Url field. Add a Name to the query and add the XML data source url in the Data Url field.
Even better, you can close the spreadsheet, come back to it later, add more data, and export it as JSON (the Apps Script remains associated with the spreadsheet). The one caveat is that when you re-open the spreadsheet, it might take a few seconds for the Export JSON menu to appear.
Have you looked into Content Service? You would generate the XML and serve it via Content Service, set the XML mime-type, then use downloadAsFile to tell the browser to just download the file instead of displaying it.
ContentService will allow you granular control over what exactly you want the XML to look like. You can also let Google create the XML Atom/RSS feed for you by publishing your sheet.
In the Old Sheets, the Publish option allowed XML export. (No longer supported.) Here's a sample of the XML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With