Convert automatically Google Sheets docs to .txt tabular text file - google-sheets

I want to import Google-SpreadSheet data to lotus notes but not do no support the import from .gsheet filo so i want to automatically convert .gsheet doc to .txt file and after that import it using LotusNotes Script to create a doc with informations contained in that doc.
I must have to start form a .gsheet file.
Which are my options?
Can i use windows scipt ?

The first step is, to get the csv from the spreadsheet. Accoring to responses to this post in stackoverflow this is simply a matter of using the right url.
As soon as you have the url you can use LotusScript- Functions to call that URL and import the csv- data to your documents / database.
Just google for the right starting point (e.g. "lotusscript read web site") and come back if you have concrete questions in your created script.

Related

Download embeded google sheets

as I'm not a web developer by any means, this is me just asking a question for that I have not found a solution for.
I have a google sheet with multiple pages/sheets within it. the file is embeded in an iframe inside a webpage and I pulled the url and can open it directly using the url. the following link is just an example as I can't share the actual link since I am not allowed to:
https://docs.google.com/spreadsheets/d/e/{key}/pubhtml?widget=true&headers=false
I have tried this:
https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key={key}
and is not working I get an error:
Sorry, unable to open the file at present.
Please check the address and try again.
the file is not meant for anyone to download nor share. Furthremore, since it is continuosely manually updated by author and I need to keep track of updates, taking screenshots is not efficient since the file is too big.
is there any way I can download the actual sheet to my device (so I can compare file updates over the long run)
Thank you.
I believe your goal as follows.
You want to download a Google Spreadsheet.
You are the owner of Google Spreadsheet.
The Spreadsheet is published as the Web publish. So the URL of Spreadsheet is https://docs.google.com/spreadsheets/d/e/2PACX-1vTl9bcwMSjoxYj406evzJefFodkVEUlV2KIq34Y5V8BFWJygAFrPSA7L5d89TASDUjkPG4b2SfN2rpe/pubhtml?widget=true&headers=false.
Issue and workaround:
Unfortunately, the Google Spreadsheet cannot be directly downloaded as the Google Spreadsheet. It seems that this is the current specification. In this case, it is required to export the Google Spreadsheet as other mimeType. For example, it's XLSX format, PDF format and CSV format. But the URL of https://docs.google.com/spreadsheets/d/e/2PACX-1vTl9bcwMSjoxYj406evzJefFodkVEUlV2KIq34Y5V8BFWJygAFrPSA7L5d89TASDUjkPG4b2SfN2rpe/pubhtml?widget=true&headers=false cannot directly export. So, in this answer, as a workaround, I would like to propose to use the URL for exporting Google Spreadsheet as other mimeType.
When your URL is used, the URL for exporting is as follows.
Modified url:
https://docs.google.com/spreadsheets/d/e/2PACX-1vTl9bcwMSjoxYj406evzJefFodkVEUlV2KIq34Y5V8BFWJygAFrPSA7L5d89TASDUjkPG4b2SfN2rpe/pub?output=xlsx
In this case, when you access to above URL using browser, your Spreadsheet can be exported as a XLSX file.
When output=xlsx is modified to output=pdf and output=csv, you can export as a PDF file and a CSV file, respectively.
When you want to export the specific sheetm please use the sheet ID like gid=0. The URL is as follows.
https://docs.google.com/spreadsheets/d/e/2PACX-1vTl9bcwMSjoxYj406evzJefFodkVEUlV2KIq34Y5V8BFWJygAFrPSA7L5d89TASDUjkPG4b2SfN2rpe/pub?output=xlsx&gid=0
Note:
When you want to make users downloading the Spreadsheet, you can add the tag a as follows.
Download

How can I send google sheets with the script

I have google sheets with a script included (the script is a simple function that I made to calculate something in the sheet). I want to send it to my colleague.
When I try to download it and send it or open it locally I get error msg "Unknow function".
How can I download it and send it to my colleague with the script included?
You have a couple of alternatives.
Solution 1
Create a new "demo" sheet, include the script, change permissions to Anyone with the link can edit (or view), send them the link and ask them to make a copy of it.
You could also send them just the link to it with copy instead of edit in the end of it (https://docs.google.com/spreadsheets/d/xxxxxxxxx/copy)
Solution 2
Copy the script to a simple text file (.txt) and send them the file. They can then copy/paste it using the Script editor on their sheet.
NOTE: Do not use any Word processor (like Office Word, Google Docs, etc) because they leave residue of entities that could render the code unusable.

Using IMPORTRANGE to import from Excel file in Google Drive

To import an entire sheet of data from another spreadsheet using IMPORTRANGE I'd do something like this:
=importrange("google-drive-id-for-spreadsheet","A:AR")
This works fine for a Google Sheets spreadsheet source, but if the source file is an Excel spreadsheet, I get a #Ref! error in the cell and the hover comment is:
Error Spreadsheet cannot be found.
I'm presuming this is because IMPORTRANGE doesn't work with Excel files, so how can I achieve the same thing?
I don't mind working with scripts but would prefer a formula solution if possible.
Edit: This happens whether I use the full URL or just the spreadsheet key and if I use the sheet name with the range or not. I've tried several files and it always works with the Google Sheets files and never works with Excel files.
Something occurred to me about the ownership and location of these files. Somebody else is the owner of the spreadsheet that I want the IMPORTRANGE formula in. I have full edit permissions. The folder that the spreadsheet resides in is owned by the same guy, it has been shared with me and I have added it to my Drive. In a subfolder of this folder is where the source files are. I am the owner of the subfolder and the source files within, both Excel and Google Sheets files.
Could this setup have anything to do with the results I'm getting?
Edit: I've had the ownership of the folders (all the way up the hierarchy) and relevant files transferred to me and it's still doing the same thing.
This is clearly only a work around and not an answer, but I had to do something so that I could move on. The only way I could get what I wanted is to code a convert to .gsheet format first and point imortrange to that new sheet. Might help someone else get their project pointing in a working direction until this can be answered.
There are there way to fix this problem:
Convert the Excel spreadsheet to a Google spreadsheet. You can then use the importrange() function to import the data from the converted file.
Export the Excel spreadsheet to a CSV file first, then you can use a different function called the importdata() function to import that data into a Google spreadsheet.
Using Add-on: "Sheetgo"
You should watch this video:
How to automatically import Excel Data to Google Sheets?

Export data to XLS (not via CSV) on iOS

I need to export some data to an .XLS file, pdf, and print.
I already tried the simple solution: exporting it to .CSV with CHCSVWriter. It works for printing and saving it to pdf (I open the CSV in a UIWebView and get the PDF or print from there). However, to use the CSV to be open in excel has two main problems:
1 - First, as the name says, in the CSV the values are separated by commas, and in some versions of Excel, it requires the user to separate 'manually' in cells.
2 - I have hebrew characters, and I already tried all the string encodings, and can't have both hebrew and latin characters.
So, after giving up after days of trying to use CSV to solve the issues above, I gave up. How can I export my data to XLS?
The LibXL library provides this functionality for both xls and xlsx formats. There is no iOS version, but people say the iOS version is coming. You may want to contact LibXL support to confirm this.
EDIT:
The iOS version is available now.
This article explains how to programmatically create an Excel (.xls) file without using any external library. It just opens a file stream and it writes XML contents straight to it.
It is written in C#, but the core information coming out of it is the XML formatting used to create nodes and fill attributes for corresponding cell values and formatting.
Please consider I have not tried this myself, I found it while doing a search. Please feel free to ask if some C# bits are not clear. HTH

Strategy in exporting to Excel with formatting from ASP.NET?

So this is another exporting to Excel question.
I have a page that has a table with formatting by stylesheet.
When I export the page by setting the ContentType to application/excel and Content-Disposition to attachment, I can export the table to Excel (not CSV). However, it loses all formatting. I think it's because Excel does not load CSS and I guess that's reasonable.
So, in a scenario where I have to show the table on the web and also export to Excel, both with similar (even if not exact) formatting, what would be the best approach without using something like NPOI?
I am trying to minimize the work and keep the single template if possible. Is it necessary for me to create two separate templates: one with stylesheet, the other with embedded style in the table itself for Excel?
Having a single template with conditional formatting inside would be very messy.
Any ideas?
If you not yet solve the problem I'll recommend you to use Open XML SDK 2.0 for Microsoft Office (see http://www.microsoft.com/downloads/details.aspx?FamilyID=c6e744e5-36e9-45f5-8d8c-331df206e0d0&displaylang=en). With this way you will be able create an XLSX file without installing Excel on the server. XLSX file is compressed (like ZIP file) collection of xml files. Open XML SDK 2.0 helps you create and change XLSX file as pure xml files. At the first time if you look at Open XML SDK a lot of things look like strange, but it's only at the beginning. There are so named "Open XML SDK 2.0 Productivity Tool" (a part of Open XML SDK 2.0) which can generate a lot of useful code for you. Moreover you can create a nice Excel document which you can use as a prototype (template) of the document which you will create. So you can solve the problem of complex formating without writing of a lot of code.
Look at http://msdn.microsoft.com/en-us/library/cc850837(v=office.14).aspx for some examples and on http://openxmldeveloper.org/default.aspx. See also Creating Excel document with OpenXml sdk 2.0 as a start example. You can find also a lot of good stuffs on http://www.codeplex.com about Open XML SDK
there are several aproach
you could instantiate a excel object on your server using VSTO, and then write the document on memory and write to response the native file, but this aproach could be a litle expensive if you create a excel object per request, so you could try to do a singleton object that wraps the excel object instance
You can create a report (rdlc file) with a similar look to the grid. Then, you can have an action where you instantiate a LocalReport, pass the data you want to it and call its Render method. You then return the byte array returned by the Render method.

Resources