![script-برای-استخراج-داده-های جدول-HTML-به-اکسل-[.xls،-.csv.]-با-استفاده-از-جاوا-script](https://magicfile.ir/link-image/2022-7-23/55-avk458dq5msudbv9m5gmjkue7c69t1hk.jpg)
لینک کوتاه : https://en.magicfile.ir/?p=2587
Download script to extract HTML table data to Excel [.xls, .csv.] using JavaScript
In this post, you will learn how to extract HTML table data to Excel spreadsheets and CSV files using JavaScript. The purpose of this file is to provide IT/CS students and new programmers with a reference for learning how to extract data into Excel using pure JavaScript.
In some applications or web applications, management often needs to extract data from the system into spreadsheets or Excel CSV files. Mainly the purpose of this feature is to extract data that allows system administration to use it for other purposes. Extract to Excel features are usually implemented in conjunction with the program's reporting feature.
چگونه با استفاده از JS جدول HTML را به فایل اکسل صادر کنیم؟
There are many ways to export table data to a CSV or Excel spreadsheet. Some developers prefer to use plugins or free libraries to make this possible. By using JavaScript built-in methods and script short lines, we can achieve the mentioned feature for our web application as well. JavaScript comes with a Blob object, which is very useful for our purpose here. We can simply create a raw data like file from the HTML table and create a URL object to put in an anchor tag that allows us to download the file.
JS Blob چیست؟
A bubble is an immutable, file-like object with raw data. It can be read as text or binary data or converted to a ReadableStream so that its methods can be used to process the data. The Blob object represents JavaScript bubbles.
مراحل استخراج داده های جدول به اکسل [.xls، .csv]؟
استخراج به عنوان فایل صفحه گسترده اکسل
- HTML بیرونی جدول را در JS دریافت کنید و آن را در یک رشته سند HTML جدید قرار دهید
- Convert the HTML document string to a Blob object using the application/vnd.openxmlformats-officedocument.spreadsheetml.sheet content type.
- یک عنصر Anchor ایجاد کنید
- یک مشخصه دانلود را به انکر با نام فایل به عنوان مقدار exportedData.xls تنظیم کنید
- Create a URL Object from the Blob object and place it in the anchor href attribute
- تگ Anchor را به بدنه سند صفحه اضافه کنید
- ماشه روی برچسب Anchor کلیک کنید تا فایل صادر شده را دانلود کنید
استخراج به عنوان فایل CSV
- HTML بیرونی جدول را در JS دریافت کنید و آن را در یک رشته سند HTML جدید قرار دهید
- رشته سند HTML را با استفاده از نوع محتوای text/csv به یک شی Blob تبدیل کنید.
- یک عنصر Anchor ایجاد کنید
- Set a download property to the anchor with filename as the value, exportedData.csv
- Create a URL Object from the Blob object and place it in the anchor href attribute
- تگ Anchor را به بدنه سند صفحه اضافه کنید
- ماشه روی برچسب Anchor کلیک کنید تا فایل صادر شده را دانلود کنید
Dear user, you are offered a download.
Content tags
Convert Html table to Excel , Convert HTML table to Excel , Transfer data to Excel , Transfer Excel data to html table , From the information in the HTML table of the Excel output , Convert web pages to Excel ,Files that you may need

Download the clinic management system script in PHP/PDO source code

Wheelchair script with JavaScript and jQuery

Download sample php script to register login similar to Android template password

Hotel management system script in PHP using CodeIgniter Framework source code

Download the Aynak online store website script using PHP and MySQL
