Different mechanisms to create google sheets - c#

Are there any options apart from using the Google API for creating Google sheets?
For example, with Excel, I can create them using interop, or EPPlus or by creating a spreadsheet XML format.

Answer:
The only ways to create a Google Sheet are:
Programmatically using the Sheets API using the Spreadsheets.create() method.
Clicking one of the templates under Start a new Spreadsheet at sheets.google.com.
Directly visiting the /create endpoint at docs.google.com/spreadsheets/create Either in the browser or by making a programmatic HTTP request with a library such as HttpWebRequest/WebClient/HttpClient
Following in the File > New > Spreadsheet menu item from an already-open Spreadsheet File in the Browser.
Following the + New > Google Sheets menu item at drive.google.com and using either the Blank Spreadsheet or From a template options.
Using some third-party library such as GSpread.NET to read/write Google Sheets as normal Excel documents (not supported by Google, though these also just use the API as in the first bullet point).

Related

Create online sheets using C#, SQLServer and AngularJS

I want to achieve the following -
1)Connect to SQL Server Database to get JSON data.
2)Use the JSON data to create spreadsheet like tables with multiple tabs.
3)The spreadsheet can be edited to have additional calculated features like math functions etc.
4)Create another tab depending on data present in the spreadsheet tabs
5)Publish this spreadsheet as a view only spreadsheet.
Is this possible? I am open to use any JS library.
I am looking for any excel like application which gives us the opportunity to create the spreadsheet with multiple tab + formulas and share/socialize it.
What is the best way/example to go about implementing this feature? I want it to work with AngularJS, JavaScript.
Like mentioned previously, the best solution for this would be to start with the Sheets API Quickstart for .NET here.
After you start getting a grasp on how the Sheets API works, you can easily connect to the SQL Server and retrieve the data you want in order to create a spreadsheet with your requirements.
You might find the following links useful:
spreadsheets.create - request to create a spreadsheet which will return the newly created spreadsheet
spreadsheets.values.batchUpdate - request to write multiple values in a spreadsheet
spreadsheets.values.append - request to append values to a spreadsheet
Reference
Sheets API Quickstart;
Google Sheets API Client Library for .NET.

Google Sheet api v4 dynamic sheet range

I am trying to access a sheet to get data and copy it in a data table I'm using the google sheets api v4 but I found that I must add the range to the request params.
Although I can't know how many columns has data in that sheet but the user is the one who set the spreadsheet url, so it varies and I can't find the specific range to add to the request.
So how can I find the range with contains all the data of that spreadsheet (knowing that all the spreadsheets the use can choose has only one sheet).
Answer:
Unfortunately, there is no way of retrieving the data range of a sheet using the Google Sheets API.
Workarounds:
Google Apps Script has a .getDataRange() method of the Sheet class, which returns in A1 notation the range in which data is present in a Sheet. There is a workaround here which incorporates this method, though I am unsure if it is suitable for your use case.
Feature Request:
You can however let Google know that this is a feature that is important for the Sheets API and that you would like to request they implement it. Google's Issue Tracker is a place for developers to report issues and make feature requests for their development services. The page to file a Feature Request for the Google Sheets API is here.
References:
How to get data range of a sheet (Google Sheets API)
Google's Issue Tracker
Feature Request form for Google Sheets API

formatting and printing data using C# (NO DATABASE)

I have following data in variables
1) Patient Name,Age,Sex,Referred by Doctor.
2) TestName,Parameters(As an array) and its results
There are some variables which will be computed using formulas.
I need to send data to printer in the following format
http://www.orthoclinical.com/en-us/Documents/Sample%20lab%20report.pdf
Please point me how to implement the same.
PS: 1) I cant display data directly from Database. There are many derived parameters which will be calculated using formulas.
2)I'm newbie to C# and printing application. Please help me with pseudocode/code
have a look at itextsharp. This is a server side pdf library that uses a document object model to allow you to add your text and styling in a pretty easy manner.
main features:
itext is an open source library that allows you to create and manipulate PDF documents.
It enables developers looking to enhance web- and other applications with dynamic PDF document generation and/or manipulation.
iText is available in Java as well as in .Net and Android.
usages:
Serve PDF to a browser
Generate dynamic documents from XML files or databases
Use PDF's many interactive features
Add bookmarks, page numbers, watermarks, etc.
Split, concatenate, and manipulate PDF pages
Automate filling out of PDF forms
Add digital signatures to a PDF file
available via nuget: Install-Package iTextSharp

Importing data into Excel using XML and Excel Templates

I am generating CSV data from a C# application. This can be imported into Excel easily but I need formatting applied to the file.
One option is interop but the machine running this application will not have Office products installed so that is out.
I've been told that XML can work with Excel templates and am looking for a starter example on how to achieve this.
I have generated excel spread sheets using the excel 2003 xml format several times but you will have to consider the following features that cannot be supported using this format:
This XML Spreadsheet 2003 file format (.xml) does not retain the following features:
Auditing tracer arrows
Chart and other graphic objects
Chart sheets, macro sheets, dialog sheets
Custom views
Data consolidation references
Drawing object layers
Outlining and grouping features
Password-protected worksheet data
Scenarios
User-defined function categories
VBA projects
If that is acceptable you can use as someone suggest an open source library that allows you to generate the spreadsheet in code or as I have done you can generate the xml using either an xml transform or a using the spark template engine. Both have worked for me in the past but using the spark view engine was probably the nicest.
The best way to achieve either of these is to create a template the way you want it to look and save it as a Excel 2003 Xml format and look at the raw xml. This should make it easy for you to generate your output. You can also download the xml definition for reference.
You can use excellent OpenXML wrapper ClosedXML to generate xlsx files with formatting. Or if you want, you can use pure OpenXML. OpenXML installation is required for ClosedXML to work.

is there any way to programatically download data list from sharepoint into excel

we have some data (list) stored in sharepoint. i can manually click "Actions"-> "Export to Spreadsheet" and then run a bunch of code on the Excel output.
I now want to do this on a daily basis from a C# application. Is there anyway to programatically automated that download steps that i am doing now. (the site DOES require authentication)
the "Export to Spreadsheet" fires off some javascript (so doesn't directly just point to a URL so i can read in a URL directly (i dont think)
I would recommend getting the data using SharePoint web services and then using NPOI to convert the data into an excel spreadsheet; Use web services so that you are not limited to running the app on the server and NPOI for reading/writing to excel.
if you are not limited to excel and can use other office products, MS-Access 2007 has a very good integration with sharepoint. you can write your macro and vb scripts to run on that with minor adjustments.
you can also use it as a transfer application, if you build a simple EXPORT TO EXCEL macro, and then set it to run periodically.
Basic approach:
One you have created the spreadsheet with "Export to Spreadsheet" in SharePoint, the excel file holds a list which is linked to the sharepoint list.
This is a list object in Excel which allows for refresh from the same SharePoint list at a later date, make changes in excel and update the SharePoint list from these. So updating your download is really a refresh of the list which you originate in Excel

Categories