IronXL Support for AWS Lambda Function with .NET Core

IronXL fully supports AWS Lambda Function for .NET Standard Libraries, Core applications, .NET 5 and .NET 6 projects.

To add AWS ToolKit for visual studio follow this link Using the AWS Lambda Templates in the AWS Toolkit for Visual Studio

Installing AWS ToolKit into Visual studio enables you to create AWS Lambda Function Project. You Can Learn how to Create AWS Lambda Function Project using Visual studio using This Link

Working AWS Lambda Function Code Example

After Creating New AWS Lambda Function project you try this code snippet

    namespace AWSLambdaIronXL
    {
        public class Function
        {

        /// <summary>
        /// A simple function that takes a string and does a ToUpper
        /// </summary>
        /// <param name="input"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        public string FunctionHandler(string input, ILambdaContext context)
        {
            WorkBook workBook = WorkBook.Create(ExcelFileFormat.XLS);

            var newSheet = workBook.CreateWorkSheet("new_sheet");
            string ColumnsNames = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            foreach (char col in ColumnsNames)
            {
                for (int row = 1; row <= 50; row++)
                {
                    var cellName = $"{col}{row}";
                    newSheet[cellName].Value = $"Cell : {cellName}";
                }
            }

            return Convert.ToBase64String( workBook.ToByteArray());
        }
        }
    }
    namespace AWSLambdaIronXL
    {
        public class Function
        {

        /// <summary>
        /// A simple function that takes a string and does a ToUpper
        /// </summary>
        /// <param name="input"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        public string FunctionHandler(string input, ILambdaContext context)
        {
            WorkBook workBook = WorkBook.Create(ExcelFileFormat.XLS);

            var newSheet = workBook.CreateWorkSheet("new_sheet");
            string ColumnsNames = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            foreach (char col in ColumnsNames)
            {
                for (int row = 1; row <= 50; row++)
                {
                    var cellName = $"{col}{row}";
                    newSheet[cellName].Value = $"Cell : {cellName}";
                }
            }

            return Convert.ToBase64String( workBook.ToByteArray());
        }
        }
    }
Namespace AWSLambdaIronXL
		Public Class [Function]

		''' <summary>
		''' A simple function that takes a string and does a ToUpper
		''' </summary>
		''' <param name="input"></param>
		''' <param name="context"></param>
		''' <returns></returns>
		Public Function FunctionHandler(ByVal input As String, ByVal context As ILambdaContext) As String
			Dim workBook As WorkBook = WorkBook.Create(ExcelFileFormat.XLS)

			Dim newSheet = workBook.CreateWorkSheet("new_sheet")
			Dim ColumnsNames As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
			For Each col As Char In ColumnsNames
				For row As Integer = 1 To 50
					Dim cellName = $"{col}{row}"
					newSheet(cellName).Value = $"Cell : {cellName}"
				Next row
			Next col

			Return Convert.ToBase64String(workBook.ToByteArray())
		End Function
		End Class
End Namespace
VB   C#

IronXL Nuget Packages available for deployments documeted in our IronXL Nuget installation guide.